The main documentation of the Uppercase_Text_Utils Procedure contains additional explanation of this code listing.
function Uppercase_Text_Utils (String) result(Uppercase) ! Input variables. type(character,*), intent(in) :: String ! String to be uppercased. ! Output variables. type(character,255) :: Uppercase ! The uppercase version of the string. ! Internal variable. type(integer) :: letter ! Loop counter. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ! Verify requirements. VERIFY(Valid_State(String),5) ! String is valid. ! Loop through letters, setting uppercase version. Uppercase = ' ' do letter = 1, LEN_TRIM(String) if (ICHAR(String(letter:letter)) .InInterval. Minuscules) then Uppercase(letter:letter) = & CHAR(ICHAR(String(letter:letter)) + Capitalization) else Uppercase(letter:letter) = String(letter:letter) end if end do ! Verify guarantees. VERIFY(Valid_State(Uppercase),5) ! Uppercase is valid. return end function Uppercase_Text_Utils