lower Function

private elemental function lower(self)

Arguments

TypeIntentOptionalAttributesName
class(string), intent(in) :: self

Return Value type(string)


Contents

Source Code


Source Code

   elemental function lower(self)
   !< Return a string with all lowercase characters.
   !<
   !<```fortran
   !< type(string) :: astring
   !< logical      :: test_passed(1)
   !< astring = 'Hello WorLD!'
   !< test_passed(1) = astring%lower()//''=='hello world!'
   !< print '(L1)', all(test_passed)
   !<```
   !=> T <<<
   class(string), intent(in) :: self  !< The string.
   type(string)              :: lower !< Upper case string.
   integer                   :: n1    !< Characters counter.
   integer                   :: n2    !< Characters counter.

   if (allocated(self%raw)) then
      lower = self
      do n1=1, len(self%raw)
         n2 = index(UPPER_ALPHABET, self%raw(n1:n1))
         if (n2>0) lower%raw(n1:n1) = LOWER_ALPHABET(n2:n2)
      enddo
   endif
   endfunction lower