escape

Summary

Escapes JS++ escape sequences with a preceding backslash.

Usage

public string escape()

Returns

An escaped version of the original string with all special characters prefixed with the JS++ escape character (\).

Description

Escapes the following characters by adding a preceding backslash (\) character:

Escape Sequence Description
' Single quote
" Double quote
` Grave accent
\ Backslash
/ Forward slash
\n New line
\r Carriage return
\t Tab
\b Backspace
\f Form Feed
\v Vertical Tab
\0 Null character

Examples

Basic Usage
1
2
3
4
import System;
 
string foobar = "foo\nbar";
Console.log(foobar.escape()); // "foo\\nbar"

Share

HTML | BBCode | Direct Link