string_assign_string Subroutine

private pure subroutine string_assign_string(lhs, rhs)

Arguments

TypeIntentOptionalAttributesName
class(string), intent(inout) :: lhs
type(string), intent(in) :: rhs

Contents

Source Code


Source Code

   pure subroutine string_assign_string(lhs, rhs)
   !< Assignment operator from string input.
   !<
   !<```fortran
   !< type(string) :: astring
   !< type(string) :: anotherstring
   !< logical      :: test_passed(1)
   !< astring = 'hello'
   !< anotherstring = astring
   !< test_passed(1) = astring%chars()==anotherstring%chars()
   !< print '(L1)', all(test_passed)
   !<```
   !=> T <<<
   class(string), intent(inout) :: lhs !< Left hand side.
   type(string),  intent(in)    :: rhs !< Right hand side.

   if (allocated(rhs%raw)) lhs%raw = rhs%raw
   endsubroutine string_assign_string