Uri.IsHexEncoding(String, Int32) Metoda

Definice

Určuje, zda je znak v řetězci šestnáctkový.

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

Řetězec, který chcete zkontrolovat.

index
Int32

Umístění pattern pro kontrolu šestnáctkového kódování

Návraty

Boolean

trueje-li pattern šestnáctkové kódování v zadaném umístění, jinak . false

Příklady

Následující příklad kódu určuje, zda je znak šestnáctkový kód, a pokud ano, zapíše ekvivalentní znak do konzoly.

String^ testString = "%75";
int index = 0;
if ( Uri::IsHexEncoding( testString, index ) )
{
   Console::WriteLine( "The character is {0}",
      Uri::HexUnescape( testString, index ) );
}
else
{
   Console::WriteLine( "The character is not hex encoded" );
}
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

Poznámky

Metoda IsHexEncoding kontroluje šestnáctkové kódování, které se řídí vzorem %hexhex v řetězci, kde "šestnáctkový" je číslice od 0 do 9 nebo písmeno od A-F (nerozlišující velká a malá písmena).

Platí pro