uppercase Function

private pure function uppercase(str) result(upper)

Convert a string to uppercase, should use pic_ascii!

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: str

Return Value character(len=:), allocatable


Called by

proc~~uppercase~~CalledByGraph proc~uppercase uppercase proc~extract_element extract_element proc~extract_element->proc~uppercase

Variables

Type Visibility Attributes Name Initial
integer, private :: i
integer, private :: ic

Source Code

   pure function uppercase(str) result(upper)
      !! Convert a string to uppercase, should use pic_ascii!
      character(len=*), intent(in) :: str
      character(len=:), allocatable :: upper
      integer :: i, ic

      allocate (character(len=len(str)) :: upper)
      upper = str

      do i = 1, len(str)
         ic = iachar(str(i:i))
         if (ic >= iachar('a') .and. ic <= iachar('z')) then
            upper(i:i) = achar(ic - 32)
         end if
      end do
   end function uppercase