string_concat_string Function

private pure function string_concat_string(lhs, rhs) result(concat)

Concatenation with string.

 type(string) :: astring
 type(string) :: anotherstring
 logical      :: test_passed(1)
 astring = 'Hello '
 anotherstring = 'Bye bye'
 test_passed(1) = astring//anotherstring=='Hello Bye bye'
 print '(L1)', all(test_passed)

Type Bound

string

Arguments

Type IntentOptional Attributes Name
class(string), intent(in) :: lhs

Left hand side.

type(string), intent(in) :: rhs

Right hand side.

Return Value character(kind=CK, len=:), allocatable

Concatenated string.


Contents

Source Code


Source Code

   pure function string_concat_string(lhs, rhs) result(concat)
   !< Concatenation with string.
   !<
   !<```fortran
   !< type(string) :: astring
   !< type(string) :: anotherstring
   !< logical      :: test_passed(1)
   !< astring = 'Hello '
   !< anotherstring = 'Bye bye'
   !< test_passed(1) = astring//anotherstring=='Hello Bye bye'
   !< print '(L1)', all(test_passed)
   !<```
   !=> T <<<
   class(string), intent(in)              :: lhs    !< Left hand side.
   type(string),  intent(in)              :: rhs    !< Right hand side.
   character(kind=CK, len=:), allocatable :: concat !< Concatenated string.

   concat = ''
   if (allocated(lhs%raw)) concat = lhs%raw
   if (allocated(rhs%raw)) concat = concat//rhs%raw
   endfunction string_concat_string