diff --git a/src/stdlib_ascii.f90 b/src/stdlib_ascii.f90 index c1b159bc7..2bcfdfdc8 100644 --- a/src/stdlib_ascii.f90 +++ b/src/stdlib_ascii.f90 @@ -144,14 +144,17 @@ pure logical function is_graphical(c) pure logical function is_printable(c) character(len=1), intent(in) :: c !! The character to test. integer :: ic - ic = iachar(c) ! '~' - is_printable = c >= ' ' .and. ic <= int(z'7E') + ic = iachar(c) + !The character is printable if it's between ' ' and '~' in the ASCII table + is_printable = ic >= iachar(' ') .and. ic <= int(z'7E') end function !> Checks whether `c` is a lowercase ASCII letter (a .. z). pure logical function is_lower(c) character(len=1), intent(in) :: c !! The character to test. - is_lower = (c >= 'a') .and. (c <= 'z') + integer :: ic + ic = iachar(c) + is_lower = ic >= iachar('a') .and. ic <= iachar('z') end function !> Checks whether `c` is an uppercase ASCII letter (A .. Z).