Uri.FromHex(Char) Uri.FromHex(Char) Uri.FromHex(Char) Uri.FromHex(Char) Method

定義

16 進数の数字に対応する 10 進数値を取得します。Gets the decimal value of a hexadecimal digit.

public:
 static int FromHex(char digit);
public static int FromHex (char digit);
static member FromHex : char -> int
Public Shared Function FromHex (digit As Char) As Integer

パラメーター

digit
Char Char Char Char

変換する 16 進数の数字 (0 ~ 9、a ~ f、A ~ F)。The hexadecimal digit (0-9, a-f, A-F) to convert.

戻り値

指定した 16 進数に対応する 0 ~ 15 の数値を含む Int32 値。An Int32 value that contains a number from 0 to 15 that corresponds to the specified hexadecimal digit.

例外

digit が有効な 16 進数の数字 (0 ~ 9、a ~ f、A ~ F) ではありません。digit is not a valid hexadecimal digit (0-9, a-f, A-F).

次の例では、かどうか、文字が 16 進数の文字がの場合は、対応する 10 進値をコンソールに出力を決定します。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)

注釈

FromHexメソッドが 16 進数を表す文字に変換します (0 ~ 9、a ~ f、A ~ F) を 10 進値 (0 ~ 15) にします。The FromHex method converts a character representing a hexadecimal digit (0-9, a-f, A-F) to its decimal value (0 to 15). 場合digitは有効な 16 進ではありません、ArgumentException例外がスローされます。If digit is not a valid hexadecimal digit, an ArgumentException exception is thrown.

適用対象