append(3f) - [M_overload] append sets of strings to one another (LICENSE:PD)
Synopsis
Description
Options
Returns
Examples
Author
License
function append(set1,set2) result(array)
character(len=*),intent(in),optional :: set1, set2 character(len=:),allocatable :: array(:)
append(3f) appends any standard intrinsic string or string array to another, creating a new array containing all the elements of both inputs.It is also available as the .append. operator, or as an overload of the plus operator (+).
set1,set2 character strings or arrays to append to one another, adjusting the width to accomodate the longest width.
array A string array composed of all the elements from both input strings or arrays.
Sample program:
program demo_append use :: M_overload, only : append use :: M_overload, only : operator(.append.) use :: M_overload, only : operator( + ) implicit none character(:), allocatable :: str(:) ! ! plus (+) operator overload str = "This" + "is" + "an" + "array" + "of" + "characters" print "(([,A,]))", str print (*(g0)), size=,size(str), ,len=,len(str) ! ! .append. str = & "This" .append. "is" & .append. "an" .append. "array" & .append. "of" .append. "characters" print "(([,A,]))", str ! ! append() str = append("This","is") + & append("an","array") + & append("of","characters") print "(([,A,]))", strResults:end program demo_append
> [This ] > [is ] > [an ] > [array ] > [of ] > [characters] > size=6,len=10 > [This ] > [is ] > [an ] > [array ] > [of ] > [characters] > [This ] > [is ] > [an ] > [array ] > [of ] > [characters]
John S. Urban; Based on a Fortran Discourse example by PierU, May 15, 2025.
Nemo Release 3.1 | append (3) | June 29, 2025 |