====== stresc ======
===== Description =====
Process [[wp>Escape_character|escape sequences]] in a string.
===== Function prototype =====
string stresc
===== Arguments =====
^ Name ^ Type ^ Comment ^
| //Text// | string | The text string to be escaped. |
===== Return value =====
A string containing the escaped text.
===== Example =====
string s
set s "The newlines has been escaped\\r\\n...and so have the \\\"quotation marks\\\""
// echo the escaped text
echo "Escaped:"
echo
// echo the unescaped text
echo "Unescaped:"
echo s
The escape sequences above needed to be double-escaped (i.e. '\\n') because the script interpreter processes escape sequences in literal strings //once//.
... the output of which is written to the event log by [[plugins:general:zeoscript:reference:functions:echo]] as:
Escaped:
The newlines has been escaped
...and so have the "quotation marks"
Unescaped:
The newlines has been escaped\r\n...and so have the \"quotation marks\"
===== Comments =====
==== Recognised escape sequences ====
^ Sequence ^ Interpreted as... ^
| \n | Newline |
| \r | Carriage return |
| \t | Tab |
| \" | Quotation mark |
| \\ | Backslash |
| \0 | NULL |
===== See also =====
* [[plugins:general:zeoscript:reference:functions:strreplace]]