Uri.HexUnescape Method

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
)
public static char HexUnescape (
	String pattern, 
	/** @ref */ int index
)
Not applicable.

Parameters

pattern

The hexadecimal representation of a character.

index

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

Return Value

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 typeCondition

ArgumentOutOfRangeException

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, 0))
     Console.WriteLine("The character is {0}", Uri.HexUnescape(testString, ref index));
else
     Console.WriteLine("The character is not hexadecimal encoded");

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0

XNA Framework

Supported in: 1.0

Community Additions

ADD
Show: