XLISP > XLISP 2.0  -  Contents  -  Reference  -  Previous | Next

digit-char-p


Type:   -   predicate function (subr)
Source:   -   xlstr.c

Syntax

(digit-char-p char)
char - a character expression
returns - the digit weight if character is a digit, NIL otherwise

Description

The 'digit-char-p' predicate function checks if the 'char' expression is a numeric digit. If 'char' is numeric digit, the equivalent integer value is returned, otherwise a NIL is returned. Decimal digits are '0' [ASCII decimal value 48] through '9' [ASCII decimal value 57].

Examples

(digit-char-p #\0)   ; returns 0
(digit-char-p #\9)   ; returns 9
(digit-char-p #\A)   ; returns NIL
(digit-char-p #\a)   ; returns NIL
(digit-char-p #\.)   ; returns NIL
(digit-char-p #\-)   ; returns NIL
(digit-char-p #\+)   ; returns NIL

Note: Other non-digit characters used in numbers are NOT included: plus [+], minus [-], exponent [e or E] and decimal point [.].

Common Lisp: Common Lisp supports the use of an optional radix parameter. This option specifies numeric base. This allows the 'digit-char-p' to function properly for hexadecimal digits [for example]. Common LISP supports up to base 36 radix systems. XLISP does not support this radix parameter.

See the digit-char-p predicate function in the XLISP 2.0 manual.

  Back to Top


XLISP > XLISP 2.0  -  Contents  -  Reference  -  Previous | Next