Skip to content

Latest commit

 

History

History
19 lines (13 loc) · 930 Bytes

string.md

File metadata and controls

19 lines (13 loc) · 930 Bytes

string

(string x)

Coerces a string designator to a string. A string is returned unchanged, a symbol yields its symbol-name (a keyword's leading : and a gensym's #: are package markers and are stripped), and a character yields a one-character string. t and nil coerce like symbols ("T" / "NIL"). Symbols read upcased like Common Lisp, so (string 'foo) is "FOO" and (string 'car) is "CAR".

A non-designator argument signals an error on every backend. string is the single coercion every string-designator position routes through -- the string-trim family's trimmed value, the case operators, string= and the ordering predicates -- so anything it accepted silently would become a wrong answer there instead of a type error.

(string 'foo) ; => "FOO"
(string #\a) ; => "a"
(string "already") ; => "already"