Core Function Escape

From Sputnik Wiki
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