upper Function

private elemental function upper(self)

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 Bound

string

Arguments

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

The string.

Return Value type(string)

Upper case string.


Called by

proc~~upper~~CalledByGraph proc~upper stringifor_string_t::string%upper proc~decode stringifor_string_t::string%decode proc~decode->proc~upper proc~encode stringifor_string_t::string%encode proc~encode->proc~upper proc~read_file~2 stringifor_string_t::string%read_file proc~read_file~2->proc~upper proc~read_lines~2 stringifor_string_t::string%read_lines proc~read_file~2->proc~read_lines~2 proc~read_line stringifor_string_t::string%read_line proc~read_line->proc~upper proc~write_file~2 stringifor_string_t::string%write_file proc~write_file~2->proc~upper proc~write_line stringifor_string_t::string%write_line proc~write_line->proc~upper proc~glob_string stringifor_string_t::string%glob_string proc~glob_string->proc~read_file~2 proc~read_lines~2->proc~read_line interface~glob stringifor_string_t::glob interface~glob->proc~glob_string proc~glob_character stringifor_string_t::string%glob_character interface~glob->proc~glob_character proc~glob_character->interface~glob program~volatile_doctest~16 volatile_doctest program~volatile_doctest~16->interface~glob program~volatile_doctest~69 volatile_doctest program~volatile_doctest~69->interface~glob program~volatile_doctest~80 volatile_doctest program~volatile_doctest~80->interface~glob

Contents

Source Code


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