Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(string), | intent(in) | :: | self |
elemental function is_upper(self) !< Return true if all characters in the string are uppercase. !< !<```fortran !< type(string) :: astring !< logical :: test_passed(3) !< astring = ' Hello World' !< test_passed(1) = astring%is_upper().eqv..false. !< astring = ' HELLO WORLD' !< test_passed(2) = astring%is_upper().eqv..true. !< astring = ' hello world' !< test_passed(3) = astring%is_upper().eqv..false. !< print '(L1)', all(test_passed) !<``` !=> T <<< class(string), intent(in) :: self !< The string. logical :: is_upper !< Result of the test. integer :: c !< Character counter. is_upper = .false. if (allocated(self%raw)) then is_upper = .true. do c=1, len(self%raw) if (index(LOWER_ALPHABET, self%raw(c:c))>0) then is_upper = .false. exit endif enddo endif endfunction is_upper