Concatenation with character (inverted).
type(string) :: astring
type(string) :: yetanotherstring
character(len=:), allocatable :: acharacter
logical :: test_passed(1)
astring = 'Hello '
acharacter = 'World!'
yetanotherstring = acharacter.cat.astring
test_passed(1) = yetanotherstring%chars()=='World!Hello '
print '(L1)', all(test_passed)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(kind=CK, len=*), | intent(in) | :: | lhs |
Left hand side. |
||
class(string), | intent(in) | :: | rhs |
Right hand side. |
Concatenated string.
elemental function character_concat_string_string(lhs, rhs) result(concat) !< Concatenation with character (inverted). !< !<```fortran !< type(string) :: astring !< type(string) :: yetanotherstring !< character(len=:), allocatable :: acharacter !< logical :: test_passed(1) !< astring = 'Hello ' !< acharacter = 'World!' !< yetanotherstring = acharacter.cat.astring !< test_passed(1) = yetanotherstring%chars()=='World!Hello ' !< print '(L1)', all(test_passed) !<``` !=> T <<< character(kind=CK, len=*), intent(in) :: lhs !< Left hand side. class(string), intent(in) :: rhs !< Right hand side. type(string) :: concat !< Concatenated string. if (allocated(rhs%raw)) then concat%raw = lhs//rhs%raw else concat%raw = lhs endif endfunction character_concat_string_string