string_concat_character Function

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

Arguments

TypeIntentOptionalAttributesName
class(string), intent(in) :: lhs
character(kind=CK,len=*), intent(in) :: rhs

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


Contents


Source Code

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

   if (allocated(lhs%raw)) then
      concat = lhs%raw//rhs
   else
      concat = rhs
   endif
   endfunction string_concat_character