Uri.IsHexDigit(Char) Methode
Definitie
Belangrijk
Bepaalde informatie heeft betrekking op een voorlopige productversie die aanzienlijk kan worden gewijzigd voordat deze wordt uitgebracht. Microsoft biedt geen enkele expliciete of impliciete garanties met betrekking tot de informatie die hier wordt verstrekt.
Bepaalt of een opgegeven teken een geldig hexadecimaal cijfer is.
public:
static bool IsHexDigit(char character);
public static bool IsHexDigit(char character);
static member IsHexDigit : char -> bool
Public Shared Function IsHexDigit (character As Char) As Boolean
Parameters
- character
- Char
Het teken dat moet worden gevalideerd.
Retouren
true als het teken een geldig hexadecimaal cijfer is; anders, false.
Voorbeelden
In het volgende voorbeeld wordt bepaald of een teken een hexadecimaal teken is en, als dat het is, de bijbehorende decimale waarde naar de console schrijft.
char testChar = 'e';
if (Uri.IsHexDigit(testChar))
Console.WriteLine("'{0}' is the hexadecimal representation of {1}", testChar, Uri.FromHex(testChar));
else
Console.WriteLine("'{0}' is not a hexadecimal character", testChar);
string returnString = Uri.HexEscape(testChar);
Console.WriteLine("The hexadecimal value of '{0}' is {1}", testChar, returnString);
let testChar = 'e'
if Uri.IsHexDigit testChar then
printfn $"'{testChar}' is the hexadecimal representation of {Uri.FromHex testChar}"
else
printfn $"'{testChar}' is not a hexadecimal character"
let returnString = Uri.HexEscape testChar
printfn $"The hexadecimal value of '{testChar}' is {returnString}"
Dim testChar As Char = "e"c
If Uri.IsHexDigit(testChar) = True Then
Console.WriteLine("'{0}' is the hexadecimal representation of {1}", testChar, Uri.FromHex(testChar))
Else
Console.WriteLine("'{0}' is not a hexadecimal character", testChar)
End If
Dim returnString As String = Uri.HexEscape(testChar)
Console.WriteLine("The hexadecimal value of '{0}' is {1}", testChar, returnString)
Opmerkingen
Hexadecimale cijfers zijn de cijfers 0 tot 9 en de letters A-F of a-f.