Uri.IsHexDigit(Char) Uri.IsHexDigit(Char) Uri.IsHexDigit(Char) Uri.IsHexDigit(Char) Method

Définition

Détermine si un caractère spécifié est un chiffre hexadécimal valide.Determines whether a specified character is a valid hexadecimal digit.

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

Paramètres

character
Char Char Char Char

Caractère à valider.The character to validate.

Retours

true si le caractère est un chiffre hexadécimal valide ; sinon, false.true if the character is a valid hexadecimal digit; otherwise, false.

Exemples

L’exemple suivant détermine si un caractère est un caractère hexadécimal et, si c’est le cas, écrit la valeur décimale correspondante dans la console.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 )
{
   Console::WriteLine( "'{0}' is the hexadecimal representation of {1}",
      testChar, Uri::FromHex( testChar ) );
}
else
{
   Console::WriteLine( "'{0}' is not a hex character", testChar );
}

String^ returnString = Uri::HexEscape( testChar );
Console::WriteLine( "The hexadecimal value of '{0}' is {1}", testChar, returnString );
char  testChar = 'e';
if (Uri.IsHexDigit(testChar) == true)
    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);
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)

Remarques

Les chiffres hexadécimaux sont les chiffres de 0 à 9 et les lettres A-F ou a-f.Hexadecimal digits are the digits 0 to 9 and the letters A-F or a-f.

S’applique à