C Library Functions  - append (3)

NAME

append(3f) - [M_overload] append sets of strings to one another (LICENSE:PD)

CONTENTS

Synopsis
Description
Options
Returns
Examples
Author
License

SYNOPSIS

function append(set1,set2) result(array)

    character(len=*),intent(in),optional :: set1, set2
    character(len=:),allocatable :: array(:)

DESCRIPTION

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 (+).

OPTIONS

set1,set2
  character strings or arrays to append to one another, adjusting the width to accomodate the longest width.

RETURNS

array A string array composed of all the elements from both input strings or arrays.

EXAMPLES

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,’]’))", str

end program demo_append

Results:

    > [This      ]
    > [is        ]
    > [an        ]
    > [array     ]
    > [of        ]
    > [characters]
    > size=6,len=10
    > [This      ]
    > [is        ]
    > [an        ]
    > [array     ]
    > [of        ]
    > [characters]
    > [This      ]
    > [is        ]
    > [an        ]
    > [array     ]
    > [of        ]
    > [characters]

AUTHOR

John S. Urban; Based on a Fortran Discourse example by PierU, May 15, 2025.

LICENSE

    MIT


Nemo Release 3.1 append (3) June 29, 2025
Generated by manServer 1.08 from 9f1e1e7f-f8e0-49dc-ad1b-1e5f26c25946 using man macros.