@@ -68,18 +68,14 @@ module stdlib_ascii
6868 ! > Checks whether `c` is an ASCII letter (A .. Z, a .. z).
6969 pure logical function is_alpha(c)
7070 character (len= 1 ), intent (in ) :: c ! ! The character to test.
71- integer :: ic
72- ic = iachar (c)
73- is_alpha = (ic >= iachar (' A' ) .and. ic <= iachar (' Z' )) .or. (ic >= iachar (' a' ) .and. ic <= iachar (' z' ))
71+ is_alpha = (c >= ' A' .and. c <= ' Z' ) .or. (c >= ' a' .and. c <= ' z' )
7472 end function
7573
7674 ! > Checks whether `c` is a letter or a number (0 .. 9, a .. z, A .. Z).
7775 pure logical function is_alphanum(c)
7876 character (len= 1 ), intent (in ) :: c ! ! The character to test.
79- integer :: ic
80- ic = iachar (c)
81- is_alphanum = (ic >= iachar (' 0' ) .and. ic <= iachar (' 9' )) .or. (ic >= iachar (' a' ) .and. ic <= iachar (' z' )) &
82- .or. (ic >= iachar (' A' ) .and. ic <= iachar (' Z' ))
77+ is_alphanum = (c >= ' 0' .and. c <= ' 9' ) .or. (c >= ' a' .and. c <= ' z' ) &
78+ .or. (c >= ' A' .and. c <= ' Z' )
8379 end function
8480
8581 ! > Checks whether or not `c` is in the ASCII character set -
@@ -100,26 +96,20 @@ pure logical function is_control(c)
10096 ! > Checks whether `c` is a digit (0 .. 9).
10197 pure logical function is_digit(c)
10298 character (len= 1 ), intent (in ) :: c ! ! The character to test.
103- integer :: ic
104- ic = iachar (c)
105- is_digit = (iachar (' 0' ) <= ic) .and. (ic <= iachar (' 9' ))
99+ is_digit = (' 0' <= c) .and. (c <= ' 9' )
106100 end function
107101
108102 ! > Checks whether `c` is a digit in base 8 (0 .. 7).
109103 pure logical function is_octal_digit(c)
110104 character (len= 1 ), intent (in ) :: c ! ! The character to test.
111- integer :: ic
112- ic = iachar (c)
113- is_octal_digit = (ic >= iachar (' 0' )) .and. (ic <= iachar (' 7' ))
105+ is_octal_digit = (c >= ' 0' ) .and. (c <= ' 7' );
114106 end function
115107
116108 ! > Checks whether `c` is a digit in base 16 (0 .. 9, A .. F, a .. f).
117109 pure logical function is_hex_digit(c)
118110 character (len= 1 ), intent (in ) :: c ! ! The character to test.
119- integer :: ic
120- ic = iachar (c)
121- is_hex_digit = (ic >= iachar (' 0' ) .and. ic <= iachar (' 9' )) .or. (ic >= iachar (' a' ) .and. ic <= iachar (' f' )) &
122- .or. (ic >= iachar (' A' ) .and. ic <= iachar (' F' )) .or. (ic >= iachar (' a' ) .and. ic <= iachar (' f' ))
111+ is_hex_digit = (c >= ' 0' .and. c <= ' 9' ) .or. (c >= ' a' .and. c <= ' f' ) &
112+ .or. (c >= ' A' .and. c <= ' F' )
123113 end function
124114
125115 ! > Checks whether or not `c` is a punctuation character. That includes
@@ -165,9 +155,7 @@ pure logical function is_lower(c)
165155 ! > Checks whether `c` is an uppercase ASCII letter (A .. Z).
166156 pure logical function is_upper(c)
167157 character (len= 1 ), intent (in ) :: c ! ! The character to test.
168- integer :: ic
169- ic = iachar (c)
170- is_upper = ic >= iachar (' A' ) .and. ic <= iachar (' Z' )
158+ is_upper = (c >= ' A' ) .and. (c <= ' Z' )
171159 end function
172160
173161 ! > Checks whether or not `c` is a whitespace character. That includes the
@@ -177,7 +165,7 @@ pure logical function is_white(c)
177165 character (len= 1 ), intent (in ) :: c ! ! The character to test.
178166 integer :: ic
179167 ic = iachar (c) ! TAB, LF, VT, FF, CR
180- is_white = ic == iachar ( ' ' ) .or. (ic >= int (z' 09' ) .and. ic <= int (z' 0D' ))
168+ is_white = (c == ' ' ) .or. (ic >= int (z' 09' ) .and. ic <= int (z' 0D' ));
181169 end function
182170
183171 ! > Checks whether or not `c` is a blank character. That includes the
@@ -186,7 +174,7 @@ pure logical function is_blank(c)
186174 character (len= 1 ), intent (in ) :: c ! ! The character to test.
187175 integer :: ic
188176 ic = iachar (c) ! TAB
189- is_blank = ic == iachar ( ' ' ) .or. ic == int (z' 09' )
177+ is_blank = (c == ' ' ) .or. ( ic == int (z' 09' ));
190178 end function
191179
192180 ! > Returns the corresponding lowercase letter, if `c` is an uppercase
0 commit comments