HttpUtility.JavaScriptStringEncode 方法
本文内容
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
对字符串进行编码。
JavaScriptStringEncode(String) |
对字符串进行编码。 |
JavaScriptStringEncode(String, Boolean) |
对字符串进行编码。 |
此方法对字符串进行编码。 例如,单引号和双引号作为 \'
和 \"
包含在编码的字符串中。
- Source:
- HttpUtility.cs
- Source:
- HttpUtility.cs
- Source:
- HttpUtility.cs
对字符串进行编码。
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
要编码的字符串。
返回
已编码的字符串。
适用于
.NET 10 和其他版本
产品 | 版本 |
---|---|
.NET | Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10 |
.NET Framework | 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0, 2.1 |
- Source:
- HttpUtility.cs
- Source:
- HttpUtility.cs
- Source:
- HttpUtility.cs
对字符串进行编码。
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
一个指示双引号是否将包含在已编码字符串周围的值。
返回
已编码的字符串。
适用于
.NET 10 和其他版本
产品 | 版本 |
---|---|
.NET | Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10 |
.NET Framework | 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0, 2.1 |