Next: I/O functions, Previous: String formatting, Up: Library [Contents][Index]
These functions check whether all characters of str fall into a
certain character class according to the ‘C’ (‘POSIX’)
locale23. ‘True’ (1) is returned if they do, ‘false’ (0)
is returned otherwise. In the latter case, the global variable
ctype_mismatch
is set to the index of the first character that
is outside of the character class (characters are indexed from 0).
Checks for alphanumeric characters:
isalnum("a123") ⇒ 1 isalnum("a.123") ⇒ 0 (ctype_mismatch = 1)
Checks for an alphabetic character:
isalnum("abc") ⇒ 1 isalnum("a123") ⇒ 0
Checks whether all characters in str are 7-bit ones, that fit into the ASCII character set.
isascii("abc") ⇒ 1 isascii("ab\0200") ⇒ 0
Checks if str contains only blank characters; that is, spaces or tabs.
Checks for control characters.
Checks for digits (0 through 9).
Checks for any printable characters except spaces.
Checks for lower-case characters.
Checks for printable characters including space.
Checks for any printable characters which are not a spaces or alphanumeric characters.
Checks for white-space characters, i.e.: space, form-feed (‘\f’), newline (‘\n’), carriage return (‘\r’), horizontal tab (‘\t’), and vertical tab (‘\v’).
Checks for uppercase letters.
Checks for hexadecimal digits, i.e. one of ‘0’, ‘1’, ‘2’, ‘3’, ‘4’, ‘5’, ‘6’, ‘7’, ‘8’, ‘9’, ‘a’, ‘b’, ‘c’, ‘d’, ‘e’, ‘f’, ‘A’, ‘B’, ‘C’, ‘D’, ‘E’, ‘F’.
Next: I/O functions, Previous: String formatting, Up: Library [Contents][Index]