encoder class : JavaScriptStringEncode(string) method
Description
Encods a string.
Syntax
encoderInstance.JavaScriptStringEncode(string targetString)
Arguments
Class | Name | Description |
string | targetString | A string to encode. |
Return value
Class | Description |
string | An 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.