Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

Uri.HexUnescape Method (String, Int32)


Converts a specified hexadecimal representation of a character to the character.

Namespace:   System
Assembly:  System (in System.dll)

public static char HexUnescape(
	string pattern,
	ref int index


Type: System.String

The hexadecimal representation of a character.

Type: System.Int32

The location in pattern where the hexadecimal representation of a character begins.

Return Value

Type: System.Char

The character represented by the hexadecimal encoding at position index. If the character at index is not hexadecimal encoded, the character at index is returned. The value of index is incremented to point to the character following the one returned.

Exception Condition

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, ref index));
     Console.WriteLine("The character is not hexadecimal encoded");

.NET Framework
Available since 1.1
Return to top
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
© 2015 Microsoft