User Tools


Differences

This shows you the differences between two versions of the page.

Link to this comparison view

cl:functions:string [2019/09/14 05:00]
cl:functions:string [2019/09/20 08:00] (current)
Line 1: Line 1:
 +====== Function STRING ======
 +
 +====Syntax====
 +  * **string** //x// → //string//
 +
 +====Arguments and Values====
 +  * //x// - a //​[[CL:​Glossary:​string]]//,​ a //​[[CL:​Glossary:​symbol]]//,​ or a //​[[CL:​Glossary:​character]]//​.
 +  * //string// - a //​[[CL:​Glossary:​string]]//​.
 +
 +====Description====
 +Returns a //​[[CL:​Glossary:​string]]//​ described by //x//; specifically:​
 +
 +  * If //x// is a //​[[CL:​Glossary:​string]]//,​ it is returned. ​
 +  * If //x// is a //​[[CL:​Glossary:​symbol]]//,​ its //​[[CL:​Glossary:​name]]//​ is returned. ​
 +  * If //x// is a //​[[CL:​Glossary:​character]]//,​ then a //​[[CL:​Glossary:​string]]//​ containing that one //​[[CL:​Glossary:​character]]//​ is returned.
 +  * **string** might perform additional, //​[[CL:​Glossary:​implementation-defined]]//​ conversions.
 +
 +====Examples====
 +<​blockquote> ​
 +(string "​already a string"​) <​r>"​already a string"​ </r>
 +(string 'elm) <​r>"​ELM"​ </r>
 +(string #\\c) <​r>"​c"​ </r>
 +</​blockquote>​
 +
 +====Affected By====
 +None.
 +
 +====Exceptional Situations====
 +In the case where a conversion is defined neither by this specification nor by the //​[[CL:​Glossary:​implementation]]//,​ an error of type **[[CL:​Types:​type-error]]** is signaled.
 +
 +====See Also====
 +  * **[[CL:​Functions:​coerce|Function COERCE]]**
 +  * **[[CL:​Types:​string|Type STRING]]**
 +
 +====Notes====
 +**[[CL:​Functions:​coerce]]** can be used to convert a //​[[CL:​Glossary:​sequence]]//​ of //​[[CL:​Glossary:​characters]]//​ to a //​[[CL:​Glossary:​string]]//​.
 +
 +**[[CL:​Functions:​prin1-to-string]]**,​ **[[CL:​Functions:​princ-to-string]]**,​ **[[CL:​Functions:​write-to-string]]**,​ or **[[CL:​Functions:​format]]** (with a first argument of **[[CL:​Constant Variables:​nil]]**) can be used to get a //​[[CL:​Glossary:​string]]//​ representation of a //​[[CL:​Glossary:​number]]//​ or any other //​[[CL:​Glossary:​object]]//​.
 +
 +\issue{CHARACTER-PROPOSAL:​2-1-1} \issue{CHARACTER-PROPOSAL:​2-1-1} \issue{STRING-COERCION:​MAKE-CONSISTENT} \issue{STRING-COERCION:​MAKE-CONSISTENT}