encoder class : JavaScriptStringEncode(string,bool) method
Description
Encodes a string.
Syntax
encoderInstance.JavaScriptStringEncode(string targetString, bool addDoubleQuotes)
Arguments
| Class | Name | Description |
| string | targetString | A string to encode. |
| bool | addDoubleQuotes | A value that indicates whether double quotation marks will be included around the encoded string. |
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, true); // "This is \u0027." |
Notes
It's a wrapper of the System.Web.HttpUtility.JavaScriptStringEncode(String,Bool) method.


