Return a string with all uppercase characters.
type(string) :: astring
logical :: test_passed(1)
astring = 'Hello WorLD!'
test_passed(1) = astring%upper()//''=='HELLO WORLD!'
print '(L1)', all(test_passed)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(string), | intent(in) | :: | self |
The string. |
Upper case string.
elemental function upper(self) !< Return a string with all uppercase characters. !< !<```fortran !< type(string) :: astring !< logical :: test_passed(1) !< astring = 'Hello WorLD!' !< test_passed(1) = astring%upper()//''=='HELLO WORLD!' !< print '(L1)', all(test_passed) !<``` !=> T <<< class(string), intent(in) :: self !< The string. type(string) :: upper !< Upper case string. integer :: n1 !< Characters counter. integer :: n2 !< Characters counter. if (allocated(self%raw)) then upper = self do n1=1, len(self%raw) n2 = index(LOWER_ALPHABET, self%raw(n1:n1)) if (n2>0) upper%raw(n1:n1) = UPPER_ALPHABET(n2:n2) enddo endif endfunction upper