uppercase Subroutine

public subroutine uppercase(string)

Convert all lower case characters in a string to upper case.

Arguments

TypeIntentOptionalAttributesName
character(len=*), intent(inout) :: string

Contents

Source Code


Source Code

   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