XLISP string

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

# string

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

## Syntax

(string expr)
  expr - a symbol, character, integer or string expression
  returns - a string

## Description

The 'string' function makes the 'expr' to be a string. If the 'expr' is a string, it is returned, as is. If the 'expr' is a character, a one-character string is returned. If the 'expr' is a symbol, the symbol is turned into a string. If the 'expr' is an integer, a string representing the character with an ASCII code of the lowest 8-bit of the intger will be returned:

`` | `(string integer)` | → | `(code-char (rem integer 256))` | → | `string`

## Examples

    (string 'foo)        ; returns "FOO"
    (string 'x)          ; returns "X"
    (string "abcdef")    ; returns "abcdef"
    (string #\a)         ; returns "a"
    (string #\A)         ; returns "A"
    (string #\Newline)   ; returns "\n"

See the string function in the XLISP 2.0 manual.

Back to Top

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