HttpUtility.JavaScriptStringEncode 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
編碼一個字串。
多載
| 名稱 | Description |
|---|---|
| JavaScriptStringEncode(String) |
編碼一個字串。 |
| JavaScriptStringEncode(String, Boolean) |
編碼一個字串。 |
備註
此方法編碼字串。 例如,單引號與雙引號會包含\u0027\"在編碼字串中。
JavaScriptStringEncode(String)
編碼一個字串。
public:
static System::String ^ JavaScriptStringEncode(System::String ^ value);
public static string JavaScriptStringEncode(string? value);
public static string JavaScriptStringEncode(string value);
static member JavaScriptStringEncode : string -> string
Public Shared Function JavaScriptStringEncode (value As String) As String
參數
- value
- String
一個要編碼的字串。
傳回
一個編碼字串。
適用於
JavaScriptStringEncode(String, Boolean)
編碼一個字串。
public:
static System::String ^ JavaScriptStringEncode(System::String ^ value, bool addDoubleQuotes);
public static string JavaScriptStringEncode(string? value, bool addDoubleQuotes);
public static string JavaScriptStringEncode(string value, bool addDoubleQuotes);
static member JavaScriptStringEncode : string * bool -> string
Public Shared Function JavaScriptStringEncode (value As String, addDoubleQuotes As Boolean) As String
參數
- value
- String
一個要編碼的字串。
- addDoubleQuotes
- Boolean
一個表示是否會在編碼字串周圍加入雙引號的值。
傳回
一個編碼字串。