1 MODULE module_string_tools
5 FUNCTION capitalize(str) RESULT(capStr)
8 ! Returns a copy of 'str' in which all lower-case letters have been converted
9 ! to upper-case letters.
13 CHARACTER(LEN=*), INTENT(IN) :: str
14 CHARACTER(LEN=LEN(str)) :: capStr
17 INTEGER, PARAMETER :: offset = (IACHAR('a') - IACHAR('A'))
21 IF ( ( IACHAR(str(i:i)) >= IACHAR('a') ) .AND. ( IACHAR(str(i:i)) <= IACHAR('z') ) ) THEN
22 capStr(i:i) = ACHAR(IACHAR(str(i:i)) - offset)
24 capStr(i:i) = str(i:i)
28 END FUNCTION capitalize
30 END MODULE module_string_tools