Export (0) Print
Expand All

Uri.IsHexEncoding Method

Determines whether a character in a string is hexadecimal encoded.

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

public static bool IsHexEncoding (
	string pattern,
	int index
)
public static boolean IsHexEncoding (
	String pattern, 
	int index
)
public static function IsHexEncoding (
	pattern : String, 
	index : int
) : boolean

Parameters

pattern

The string to check.

index

The location in pattern to check for hexadecimal encoding.

Return Value

true if pattern is hexadecimal encoded at the specified location; otherwise, false.

The IsHexEncoding method checks for hexadecimal encoding that follows the pattern "%hexhex" in a string, where "hex" is a digit from 0 to 9 or a letter from A-F (case-insensitive).

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 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 .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0

Community Additions

ADD
Show:
© 2014 Microsoft