| 1 |
<html><head><title>XLISP digit-char-p</title> |
| 2 |
|
| 3 |
<link rel="stylesheet" type="text/css" href="reference.css"> |
| 4 |
|
| 5 |
</head> |
| 6 |
|
| 7 |
<body> |
| 8 |
|
| 9 |
<a href="../start.htm">Nyquist / XLISP 2.0</a> - |
| 10 |
<a href="../manual/contents.htm">Contents</a> | |
| 11 |
<a href="../tutorials/tutorials.htm">Tutorials</a> | |
| 12 |
<a href="../examples/examples.htm">Examples</a> | |
| 13 |
<a href="reference-index.htm">Reference</a> |
| 14 |
|
| 15 |
<hr> |
| 16 |
|
| 17 |
<h1>digit-char-p</h1> |
| 18 |
|
| 19 |
<hr> |
| 20 |
|
| 21 |
<p><table cellpadding="0" cellspacing="0" style="margin-left:10px"><tbody> |
| 22 |
<tr valign="top"> |
| 23 |
<td><nobr>Type:</nobr></td> |
| 24 |
<td><nobr> - </nobr></td> |
| 25 |
<td width="100%"><nobr>predicate function (subr)</nobr></td> |
| 26 |
</tr> |
| 27 |
<tr valign="top"> |
| 28 |
<td><nobr>Source:</nobr></td> |
| 29 |
<td><nobr> - </nobr></td> |
| 30 |
<td width="100%"><nobr>xlstr.c</nobr></td> |
| 31 |
</tr> |
| 32 |
</tbody></table></p> |
| 33 |
|
| 34 |
<h2>Syntax</h2> |
| 35 |
|
| 36 |
<dl> |
| 37 |
<dt>(digit-char-p <i>char</i>)</dt> |
| 38 |
<dd><i>char</i> - a character expression<br> |
| 39 |
returns - the digit weight if character is a digit, |
| 40 |
<a href="nil.htm">NIL</a> otherwise</dd> |
| 41 |
</dl> |
| 42 |
|
| 43 |
<h2>Description</h2> |
| 44 |
|
| 45 |
<p>The 'digit-char-p' predicate function checks if the 'char' expression is |
| 46 |
a numeric digit. If 'char' is numeric digit, the equivalent integer value |
| 47 |
is returned, otherwise a <a href="nil.htm">NIL</a> is |
| 48 |
returned. Decimal digits are '0' [ASCII decimal <nobr>value 48]</nobr> |
| 49 |
through '9' [ASCII decimal <nobr>value 57].</nobr></p> |
| 50 |
|
| 51 |
<h2>Examples</h2> |
| 52 |
|
| 53 |
<pre class="example"> |
| 54 |
(digit-char-p #\0) <font color="#008844">; returns 0</font> |
| 55 |
(digit-char-p #\9) <font color="#008844">; returns 9</font> |
| 56 |
(digit-char-p #\A) <font color="#008844">; returns NIL</font> |
| 57 |
(digit-char-p #\a) <font color="#008844">; returns NIL</font> |
| 58 |
(digit-char-p #\.) <font color="#008844">; returns NIL</font> |
| 59 |
(digit-char-p #\-) <font color="#008844">; returns NIL</font> |
| 60 |
(digit-char-p #\+) <font color="#008844">; returns NIL</font> |
| 61 |
</pre> |
| 62 |
|
| 63 |
<p><b>Note:</b> Other non-digit characters used in numbers are NOT included: |
| 64 |
plus [+], minus [-], exponent <nobr>[e or E]</nobr> and decimal point |
| 65 |
[.].</p> |
| 66 |
|
| 67 |
<p><b>Common Lisp:</b> Common Lisp supports the use of an optional radix |
| 68 |
parameter. This option specifies numeric base. This allows the |
| 69 |
'digit-char-p' to function properly for hexadecimal digits [for example]. |
| 70 |
Common LISP supports up to base 36 radix systems. XLISP does not support |
| 71 |
this radix parameter.</p> |
| 72 |
|
| 73 |
<p>See the |
| 74 |
<a href="../manual/xlisp-man-026.htm#digit-char-p">digit-char-p</a> |
| 75 |
predicate function in the <nobr>XLISP 2.0</nobr> manual.</p> |
| 76 |
|
| 77 |
<p><nobr> <a href="#top">Back to Top</nobr></a></p> |
| 78 |
|
| 79 |
<hr> |
| 80 |
|
| 81 |
<a href="../start.htm">Nyquist / XLISP 2.0</a> - |
| 82 |
<a href="../manual/contents.htm">Contents</a> | |
| 83 |
<a href="../tutorials/tutorials.htm">Tutorials</a> | |
| 84 |
<a href="../examples/examples.htm">Examples</a> | |
| 85 |
<a href="reference-index.htm">Reference</a> |
| 86 |
|
| 87 |
</body></html> |