L3DT users' wiki
Large 3D terrain generator

stresc

Description

Process escape sequences in a string.

Function prototype

string stresc <string:Text>

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 <stresc s>

// 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 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/stresc.txt · Last modified: 2017/08/31 05:47 (external edit)
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki