Core Function Escape

From Sputnik Wiki
(Difference between revisions)
Jump to: navigation, search
(Created page with "<pre> Escape( <expression>, <custom> ) </pre> === Description === Add escapes to a string. === Parameters === ==== expression ==== The string to use. ==== custom ==== Opti...")
 
m (1 revision)
 
(One intermediate revision by one user not shown)

Latest revision as of 12:37, 14 June 2015

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