encoder class : JavaScriptStringEncode(string) method

Description

Encods a string.

Syntax

encoderInstance.JavaScriptStringEncode(string targetString)

Arguments

ClassNameDescription
stringtargetStringA string to encode.

Return value

ClassDescription
stringAn encoded string.

Sample code

1:

encoder e = new encoder();

2:

string str = "This is '.";

3:

string encoded = e.JavaScriptStringEncode(str); // This is \u0027.

Notes

It's a wrapper of the System.Web.HttpUtility.JavaScriptStringEncode(String) method.

Links for reference

Copyright © Cooker All rights reserved.