Convert all lower case characters in a string to upper case.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(inout) | :: | string |
SUBROUTINE uppercase(string) !! Convert all lower case characters in a string to upper case. CHARACTER(LEN=*), INTENT(INOUT) :: string INTEGER :: i, iascii DO i = 1, LEN_TRIM(string) iascii = ICHAR(string(i:i)) IF ((iascii >= 97) .AND. (iascii <= 122)) THEN string(i:i) = CHAR(iascii - 32) END IF END DO END SUBROUTINE uppercase