Uri.FromHex メソッド
アセンブリ: System (system.dll 内)
構文Dim digit As Char Dim returnValue As Integer returnValue = Uri.FromHex(digit)
戻り値
指定した 16 進数の数字に対応する 0 ~ 15 の数値。
例外
解説FromHex メソッドは、16 進数の数字を表す文字 (0 ~ 9、a ~ f、A ~ F) を 10 進数値 (0 ~ 15) に変換します。digit が有効な 16 進数の数字でない場合は、例外 ArgumentException がスローされます。
使用例文字が 16 進文字かどうかを判断し、16 進文字である場合は対応する 10 進値をコンソールに出力する例を次に示します。
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)
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);
プラットフォームWindows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
バージョン情報
参照- Uri.FromHex メソッドのページへのリンク