File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -257,10 +257,13 @@ contains
257
257
pure function to_lower(string) result(lower_string)
258
258
character(len=*), intent(in) :: string
259
259
character(len=len(string)) :: lower_string
260
- integer :: i
260
+ integer, parameter :: wp= 32, la=65, lz= 90
261
+ integer :: i, icar
261
262
262
263
do i = 1, len(string)
263
- lower_string(i:i) = char_to_lower(string(i:i))
264
+ icar= ichar(string(i:i))
265
+ if (icar>=la.and.icar<=lz) icar= icar + wp
266
+ lower_string(i:i) = char(icar)
264
267
end do
265
268
266
269
end function to_lower
@@ -272,10 +275,13 @@ contains
272
275
pure function to_upper(string) result(upper_string)
273
276
character(len=*), intent(in) :: string
274
277
character(len=len(string)) :: upper_string
275
- integer :: i
278
+ integer, parameter :: wp= 32, BA=97, BZ= 122
279
+ integer :: i, icar
276
280
277
281
do i = 1, len(string)
278
- upper_string(i:i) = char_to_upper(string(i:i))
282
+ icar= ichar(string(i:i))
283
+ if (icar>=BA.and.icar<=BZ) icar= icar - wp
284
+ upper_string(i:i) = char(icar)
279
285
end do
280
286
281
287
end function to_upper
You can’t perform that action at this time.
0 commit comments