ASCII Functions

Introduction

Some Lisps like to extend the definition of the character classification predicates like alpha-char-p to Unicode characters. However, when parsing protocols and file formats this often is wrong as we may need to match in the ASCII range only.

For instance, in one Lisp it might happen that

;; U+0663 = ٣ = Arabic-Indic Digit Three
(digit-char-p (code-char #x0663)) => 3

while we only really want to catch the characters #\0#\9.

(ascii-digit-char-p (code-char #x0663)) => NIL

Files

Dictionary

ascii-char-p  char
Function

Returns non-NIL, when char is an ASCII character, that is a 7-bit character and NIL otherwise.

ascii-digit-char-p  char &optional (radix 10)
Function

Like digit-char-p, but will return non-NIL only for ASCII characters.

ascii-alpha-char-p  char
Function

Like alpha-char-p, but will return non-NIL only for ASCII characters.

ascii-alphanumeric-p  char
Function

Like alphanumericp, but will return non-NIL only for ASCII characters.

ascii-graphic-char-p  char
Function

Like graphic-char-p, but will return non-NIL only for ASCII characters.

ascii-white-space-p  char
Function

Returns non-NIL when char is an ASCII white space character. The following characters are regarded as white space: HT (decimal 9), NL (decimal 10), FF (decimal 12), CR (decimal 13), SP (decimal 32).


Gilbert Baumann, 2021-02-15