Skip to content

Commit b8dd3b4

Browse files
committed
to_lower/upper clearer constants definition
1 parent 8b7b1e8 commit b8dd3b4

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/stdlib_ascii.fypp

+6-6
Original file line numberDiff line numberDiff line change
@@ -223,11 +223,11 @@ contains
223223
pure function char_to_lower(c) result(t)
224224
character(len=1), intent(in) :: c !! A character.
225225
character(len=1) :: t
226-
integer, parameter :: wp= 32, la=65, lz= 90
226+
integer, parameter :: wp= 32, BA=iachar('A'), BZ=iachar('Z')
227227
integer :: k
228-
228+
!Check whether the integer equivalent is between BA=65 and BZ=90
229229
k = ichar(c)
230-
if (k>=la.and.k<=lz) k = k + wp
230+
if (k>=BA.and.k<=BZ) k = k + wp
231231
t = char(k)
232232

233233
end function char_to_lower
@@ -237,11 +237,11 @@ contains
237237
pure function char_to_upper(c) result(t)
238238
character(len=1), intent(in) :: c !! A character.
239239
character(len=1) :: t
240-
integer, parameter :: wp= 32, BA=97, BZ= 122
240+
integer, parameter :: wp= 32, la=iachar('a'), lz=iachar('z')
241241
integer :: k
242-
242+
!Check whether the integer equivalent is between la=97 and lz=122
243243
k = ichar(c)
244-
if (k>=BA.and.k<=BZ) k = k - wp
244+
if (k>=la.and.k<=lz) k = k - wp
245245
t = char(k)
246246

247247
end function char_to_upper

0 commit comments

Comments
 (0)