Uri.HexEscape(Char) Methode

Definition

Wandelt ein angegebenes Zeichen in seine hexadezimale Entsprechung um.

public:
 static System::String ^ HexEscape(char character);
public static string HexEscape(char character);
static member HexEscape : char -> string
Public Shared Function HexEscape (character As Char) As String

Parameter

character
Char

Das Zeichen, das in hexadezimale Darstellung konvertiert werden soll.

Gibt zurück

Die hexadezimale Darstellung des angegebenen Zeichens.

Ausnahmen

character ist größer als 255.

Beispiele

Im folgenden Beispiel wird ein Zeichen in die hexadezimale Entsprechung konvertiert und in die Konsole geschrieben.

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)

Gilt für: