std-princ-to-string, std-prin1-to-string | ![]() |
(std-princ-to-string <expr>) ; convert expr to string, as with princ
(std-prin1-to-string <expr>) ; convert expr to string, as with prin1
STD-PRINC-TO-STRING converts any expression to a string as if it was printed with PRINC,
STD-PRIN1-TO-STRING as if it was printed with PRIN1.
PRINC expands escape characters to a user-friendly format, in comparison to PRIN1 which is doesn't expand escape characters, which is used to print in a format suitable to being read in again with READ.
In Visual Lisp they are builtin with the vl- prefix, in Vital Lisp with the vlx- prefix. For symbols there exists a faster version: std-symbol-name.
(setq s "test") (std-princ-to-string 's) => S (std-prin1-to-string 's) => S (std-princ-to-string s) => "test" (std-prin1-to-string s) => "\"test\"" (std-princ-to-string "\nNo") => "\nNo" (std-prin1-to-string "\nNo") => "\"\\\nNo"
expr: any valid lisp expression.
A string
If not in Vital Lisp or Visual Lisp, then temporary files may be created in the %TEMP% dir. They are deleted by initialization functions and std-filename-mktemp automatically if the number exceeds a certain filesystem dependent treshold.
(std-require 'STDLISP)
Defined in STDLISP