[string->unescape] converts all escape sequences contained within the string into their Unicode equivalents, returning the result as a new string. This is the same escape processing which Lasso does for string literals. [string->unescape] permits this process to be applied to already existing string objects.
String escape processing is described under the "Quoted Strings" heading in the Lasso Language Guide:
http://www.lassosoft.com/Language-Guide-Literals
Sequence |
Value |
Description |
---|---|---|
\xhh |
Unicode character |
1-2 hex digits |
\uhhhh |
Unicode character |
4 hex digits |
\Uhhhhhhhh |
Unicode character |
8 hex digits |
\ooo |
Unicode character |
1-3 octal digits |
\:NAME: |
Unicode character |
Unicode character name |
\a |
0x07 |
Bell |
\b |
0x08 |
Backspace |
\e |
0x1B |
Escape |
\f |
0x0C |
Form feed |
\n |
0x0A |
Line feed |
\r |
0x0D |
Carriage return |
\t |
0x09 |
Tab |
\v |
0x0B |
Vertical tab |
\" |
0x22 |
Quotation mark |
\' |
0x27 |
Apostrophe |
\? |
0x3F |
Question mark |
\\ |
0x5C |
Backslash |
\<end of line> |
none |
Escape whitespace |
string->unescape
Use the [string->unescape] method. The following example converts an encoded character representing a heart into its Unicode equivalent.
Code
'I \\u2665 rhinos'->unescape
Result
I ♥ rhinos
Code
local(mystring = 'BOO!')
#mystring->append(` \:GHOST:!`)
#mystring->unescape
Result
BOO!
Code
local(mystring = `\:HEAVY CHECK MARK:`)
#mystring->append(' OK')
#mystring->unescape
Result
✔ OK
Please note that periodically LassoSoft will go through the notes and may incorporate information from them into the documentation. Any submission here gives LassoSoft a non-exclusive license and will be made available in various formats to the Lasso community.
©LassoSoft Inc 2015 | Web Development by Treefrog Inc | Privacy | Legal terms and Shipping | Contact LassoSoft
Recent Comments