AdvantageCMS.Core.Common.BaseClasses Namespace
Build With Advantage

StringExtensions..::..JavaScriptSerialize Method

Serializes the string using the JavaScript serializer, escaping special characters for safe embedding in JavaScript. The surrounding quotes are removed from the result.

Namespace:  AdvantageCMS.Core.Common
Assembly:  AdvantageCMS.Core (in AdvantageCMS.Core.dll)

Syntax


public static string JavaScriptSerialize(
	this string s
)

Parameters

s
Type: String
The string to serialize.

Return Value

The JavaScript-safe escaped string.

Examples


C#
string safe = "Line1\nLine2\tTabbed".JavaScriptSerialize(); // returns "Line1\\nLine2\\tTabbed"