Nyquist / XLISP 2.0  -  Contents | Tutorials | Examples | Reference

char


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

Syntax

(char string position)
string - a string expression
position - an integer expression
returns - the ASCII code of the character

Description

The 'char' function returns the ASCII numeric value of the character at the specified 'position' in the 'string'. A position of '0' is the first character in the string.

Examples

(char "12345" 0)          => #\1
(char "12 45" 2)          => #\Space
(string (char "1234" 3))  => "4"
(char "1234" 9)           => error: index out of range

See also:

  Back to Top


Nyquist / XLISP 2.0  -  Contents | Tutorials | Examples | Reference