character_eq_string Function

private elemental function character_eq_string(lhs, rhs) result(is_it)

Equal to character (inverted) logical operator.

 type(string)                  :: astring
 character(len=:), allocatable :: acharacter
 logical                       :: test_passed(2)
 astring = '  one '
 acharacter = 'three'
 test_passed(1) = ((acharacter==astring).eqv..false.)
 astring = 'the same '
 acharacter = 'the same '
 test_passed(2) = ((acharacter==astring).eqv..true.)
 print '(L1)', all(test_passed)

Type Bound

string

Arguments

Type IntentOptional Attributes Name
character(kind=CK, len=*), intent(in) :: lhs

Left hand side.

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

Right hand side.

Return Value logical

Opreator test result.


Contents

Source Code


Source Code

   elemental function character_eq_string(lhs, rhs) result(is_it)
   !< Equal to character (inverted) logical operator.
   !<
   !<```fortran
   !< type(string)                  :: astring
   !< character(len=:), allocatable :: acharacter
   !< logical                       :: test_passed(2)
   !< astring = '  one '
   !< acharacter = 'three'
   !< test_passed(1) = ((acharacter==astring).eqv..false.)
   !< astring = 'the same '
   !< acharacter = 'the same '
   !< test_passed(2) = ((acharacter==astring).eqv..true.)
   !< print '(L1)', all(test_passed)
   !<```
   !=> T <<<
   character(kind=CK, len=*), intent(in) :: lhs   !< Left hand side.
   class(string),             intent(in) :: rhs   !< Right hand side.
   logical                               :: is_it !< Opreator test result.

   is_it = rhs%raw == lhs
   endfunction character_eq_string