is_lower Function

private elemental function is_lower(self)

Arguments

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

The string.

Return Value logical

Result of the test.

Description

Return true if all characters in the string are lowercase.


Variables

TypeVisibility AttributesNameInitial
integer, public :: c

Character counter.


Source Code

  elemental function is_lower(self)
  !---------------------------------------------------------------------------------------------------------------------------------
  !< Return true if all characters in the string are lowercase.
  !---------------------------------------------------------------------------------------------------------------------------------
  class(string), intent(in) :: self     !< The string.
  logical                   :: is_lower !< Result of the test.
  integer                   :: c        !< Character counter.
  !---------------------------------------------------------------------------------------------------------------------------------

  !---------------------------------------------------------------------------------------------------------------------------------
  is_lower = .false.
  if (allocated(self%raw)) then
    is_lower = .true.
    do c=1, len(self%raw)
      if (index(UPPER_ALPHABET, self%raw(c:c))>0) then
        is_lower = .false.
        exit
      endif
    enddo
  endif
  return
  !---------------------------------------------------------------------------------------------------------------------------------
  endfunction is_lower