Uri.IsHexDigit Method
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Determines whether a specified character is a valid hexadecimal digit.
Namespace: System
Assembly: System (in System.dll)
Syntax
Public Shared Function IsHexDigit ( _
character As Char _
) As Boolean
public static bool IsHexDigit(
char character
)
Parameters
- character
Type: System..::.Char
The character to validate.
Return Value
Type: System..::.Boolean
A Boolean value that is true if the character is a valid hexadecimal digit; otherwise false.
Remarks
Hexadecimal digits are the digits 0 to 9 and the letters A-F or a-f.
Examples
The following example determines whether a character is a hexadecimal character and, if it is, writes the corresponding decimal value to the console.
Dim testChar As Char = "e"
If Uri.IsHexDigit(testChar) = True Then
outputBlock.Text &= testChar
outputBlock.Text &= "is the hexadecimal representation of "
outputBlock.Text &= Uri.FromHex(testChar)
outputBlock.Text &= vbCrLf
Else
outputBlock.Text &= testChar
outputBlock.Text &= "is not a hexadecimal character"
outputBlock.Text &= vbCrLf
End If
char testChar = 'e';
if (Uri.IsHexDigit(testChar) == true) {
outputBlock.Text += testChar;
outputBlock.Text += "is the hexadecimal representation of ";
outputBlock.Text += Uri.FromHex(testChar);
outputBlock.Text += "\n";
}
else {
outputBlock.Text += testChar;
outputBlock.Text += "is not a hexadecimal character\n";
}
Version Information
Windows Phone OS
Supported in: 8.1, 8.0, 7.1, 7.0
Platforms
Windows Phone