Język

Uri.IsHexEncoding(String, Int32) Metoda

Definicja

Określa, czy znak w ciągu jest zakodowany szesnastkowy.

public:
 static bool IsHexEncoding(System::String ^ pattern, int index);
public static bool IsHexEncoding(string pattern, int index);
static member IsHexEncoding : string * int -> bool
Public Shared Function IsHexEncoding (pattern As String, index As Integer) As Boolean

Parametry

pattern
String

Ciąg do sprawdzenia.

index
Int32

Lokalizacja w pliku pattern do sprawdzania kodowania szesnastkowego.

Zwraca

truejeśli pattern jest szesnastkowy zakodowany w określonej lokalizacji; w przeciwnym razie . false

Przykłady

Poniższy przykład kodu określa, czy znak jest zakodowany szesnastkowy, a jeśli tak, zapisuje równoważny znak do konsoli.

string testString = "%75";
int index = 0;
if (Uri.IsHexEncoding(testString, index))
     Console.WriteLine("The character is {0}", Uri.HexUnescape(testString, ref index));
else
     Console.WriteLine("The character is not hexadecimal encoded");
let testString = "%75"
let mutable index = 0
if Uri.IsHexEncoding(testString, index) then
    printfn $"The character is {Uri.HexUnescape(testString, &index)}"
else
    printfn "The character is not hexadecimal encoded"
Dim testString As String = "%75"
Dim index As Integer = 0
If Uri.IsHexEncoding(testString, index) Then
    Console.WriteLine("The character is {0}", Uri.HexUnescape(testString, index))
Else
    Console.WriteLine("The character is not hexadecimal encoded")
End If

Uwagi

Metoda IsHexEncoding sprawdza kodowanie szesnastkowe, które jest zgodne ze wzorcem "%hexhex" w ciągu, gdzie "szesnastkowy" jest cyfrą z zakresu od 0 do 9 lub literą z A-F (bez uwzględniania wielkości liter).

Dotyczy