Uri.HexUnescape(String, Int32) Uri.HexUnescape(String, Int32) Uri.HexUnescape(String, Int32) Uri.HexUnescape(String, Int32) Method

定义

将字符的指定十六进制表示形式转换为字符。Converts a specified hexadecimal representation of a character to the character.

public:
 static char HexUnescape(System::String ^ pattern, int % index);
public static char HexUnescape (string pattern, ref int index);
static member HexUnescape : string *  -> char
Public Shared Function HexUnescape (pattern As String, ByRef index As Integer) As Char

参数

pattern
String String String String

字符的十六进制表示形式。The hexadecimal representation of a character.

index
Int32 Int32 Int32 Int32

pattern 中字符的十六进制表示形式开始的位置。The location in pattern where the hexadecimal representation of a character begins.

返回

用十六进制编码表示的位于 index 的字符。The character represented by the hexadecimal encoding at position index. 如果位于 index 的字符不是用十六进制编码的,则返回位于 index 的字符。If the character at index is not hexadecimal encoded, the character at index is returned. index 的值递增以指向跟在返回的字符后面的字符。The value of index is incremented to point to the character following the one returned.

异常

index 小于 0,或大于等于 pattern 中的字符数。index is less than 0 or greater than or equal to the number of characters in pattern.

注解

下面的代码示例确定字符是否为十六进制编码, 如果是, 则将等效字符写入控制台。The following code example determines whether a character is hexadecimal encoded and, if so, writes the equivalent character to the console.

String^ testString = "%75";
int index = 0;
if ( Uri::IsHexEncoding( testString, index ) )
{
   Console::WriteLine( "The character is {0}",
      Uri::HexUnescape( testString, index ) );
}
else
{
   Console::WriteLine( "The character is not hex encoded" );
}
string testString = "%75";
int index = 0;
if (Uri.IsHexEncoding(testString, index))
     Console.WriteLine("The character is {0}", Uri.HexUnescape(testString, ref index));
else
     Console.WriteLine("The character is not hexadecimal encoded");
Dim testString As String = "%75"
Dim index As Integer = 0
If Uri.IsHexEncoding(testString, index) Then
    Console.WriteLine("The character is {0}", Uri.HexUnescape(testString, index))
Else
    Console.WriteLine("The character is not hexadecimal encoded")
End If

适用于