Returns the corresponding uppercase letter, if c is a lowercase
ASCII character, otherwise c itself.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=1), | intent(in) | :: | c |
A character. |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer, | private | :: | k | ||||
| integer, | private, | parameter | :: | la | = | iachar('a') | |
| integer, | private, | parameter | :: | lz | = | iachar('z') | |
| integer, | private, | parameter | :: | wp | = | iachar('a')-iachar('A') |
elemental function char_to_upper(c) result(t) character(len=1), intent(in) :: c !! A character. character(len=1) :: t integer, parameter :: wp = iachar('a') - iachar('A'), la = iachar('a'), lz = iachar('z') integer :: k !Check whether the integer equivalent is between la=97 and lz=122 k = ichar(c) if (k >= la .and. k <= lz) k = k - wp t = char(k) end function char_to_upper