upper Function

private elemental function upper(self)

Type Bound

string

Arguments

Type IntentOptional Attributes Name
class(string), intent(in) :: self

Return Value type(string)


Called by

proc~~upper~5~~CalledByGraph proc~upper~5 string%upper proc~decode~2 string%decode proc~decode~2->proc~upper~5 proc~encode~2 string%encode proc~encode~2->proc~upper~5 proc~read_file~4 string%read_file proc~read_file~4->proc~upper~5 proc~read_lines~4 string%read_lines proc~read_file~4->proc~read_lines~4 proc~read_line~2 string%read_line proc~read_line~2->proc~upper~5 proc~write_file~4 string%write_file proc~write_file~4->proc~upper~5 proc~write_lines~4 string%write_lines proc~write_file~4->proc~write_lines~4 proc~write_line~2 string%write_line proc~write_line~2->proc~upper~5 proc~glob_string~2 string%glob_string proc~glob_string~2->proc~read_file~4 proc~read_lines~4->proc~read_line~2 proc~write_lines~4->proc~write_line~2 interface~glob~2 glob interface~glob~2->proc~glob_string~2 proc~glob_character~2 string%glob_character interface~glob~2->proc~glob_character~2 none~glob~2 string%glob none~glob~2->proc~glob_string~2 none~glob~2->proc~glob_character~2 proc~glob_character~2->none~glob~2

Source Code

   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