Core Function Escape

From Sputnik Wiki
Revision as of 12:37, 14 June 2015 by UberFoX (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Escape( <expression>, <custom> )

Contents

Description

Add escapes to a string.

Parameters

expression

The string to use.

custom

Optional; A string containing characters to be escaped instead of escaping everything.

Return Value

Success: Returns a string with backslashes added. (' becomes \' and so on.).

Failure: Returns empty string.

Remarks

This adds escapes toa string regardless if the escape is valid or not so even # will be replaced with \#.

If you require more specific escape/unescape functions see the ones that deal with C/Sputnik specific escapes.

To properly escape and resolve Sputnik strings see ResolveStr( <expression> ).

Example

Escape everything

say Escape(@"Hello World!");
// Prints: \H\e\l\l\o\ \W\o\r\l\d\!

Escape only 'l' and 'o' characters

say Escape(@"Hello World!", 'lo');
// Prints: He\l\l\o W\or\ld!
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox