英語で読む

次の方法で共有


Uri.HexEscape(Char) メソッド

定義

指定した文字を等価な 16 進数値に変換します。

public static string HexEscape (char character);

パラメーター

character
Char

16 進数表現に変換する文字。

戻り値

指定した文字の 16 進数表現。

例外

character が 255 を超えています。

次の例では、文字を等価の 16 進数に変換し、コンソールに書き込みます。

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);

適用対象

製品 バージョン
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1