Uri.IsHexEncoding(String, Int32) 메서드

정의

문자열의 문자가 16진수로 인코딩되는지 여부를 확인합니다.

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

매개 변수

pattern
String

검사할 문자열입니다.

index
Int32

16진수 인코딩을 확인할 위치 pattern 입니다.

반품

true 지정된 위치에 인코딩된 16진수이면 pattern 이고, false그렇지 않으면 .

예제

다음 코드 예제에서는 문자가 16진수로 인코딩되었는지 여부를 확인하고, 인코딩된 경우 해당 문자를 콘솔에 씁니다.

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

설명

메서드는 IsHexEncoding 문자열에서 "%hexhex" 패턴을 따르는 16진수 인코딩을 확인합니다. 여기서 "hex"는 0에서 9까지의 숫자이거나 A-F의 문자(대/소문자를 구분하지 않습니다)입니다.

적용 대상