string_concat_string_string Function

private elemental function string_concat_string_string(lhs, rhs) result(concat)

Arguments

Type IntentOptional AttributesName
class(string), intent(in) :: lhs

Left hand side.

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

Right hand side.

Return Value type(string)

Concatenated string.

Description

Concatenation with string.


Variables

TypeVisibility AttributesNameInitial
character(kind=CK,len=:), public, allocatable:: temporary

Temporary concatenated string.


Source Code

  elemental function string_concat_string_string(lhs, rhs) result(concat)
  !---------------------------------------------------------------------------------------------------------------------------------
  !< Concatenation with string.
  !---------------------------------------------------------------------------------------------------------------------------------
  class(string), intent(in)              :: lhs       !< Left hand side.
  type(string),  intent(in)              :: rhs       !< Right hand side.
  type(string)                           :: concat    !< Concatenated string.
  character(kind=CK, len=:), allocatable :: temporary !< Temporary concatenated string.
  !---------------------------------------------------------------------------------------------------------------------------------

  !---------------------------------------------------------------------------------------------------------------------------------
  temporary = ''
  if (allocated(lhs%raw)) temporary = lhs%raw
  if (allocated(rhs%raw)) temporary = temporary//rhs%raw
  if (temporary/='') concat%raw = temporary
  return
  !---------------------------------------------------------------------------------------------------------------------------------
  endfunction string_concat_string_string