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.
Assembly: System (in System.dll)
Parameters
- character
- Type: System.Char
The character to validate.
Return Value
Type: System.BooleanA Boolean value that is true if the character is a valid hexadecimal digit; otherwise false.
The following example determines whether a character is a hexadecimal character and, if it is, writes the corresponding decimal value to the console.
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"; }
Show: