Base64.IsValid 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
IsValid(ReadOnlySpan<Byte>) |
驗證UTF-8文字的指定範圍是由有效的base-64編碼數據所組成。 |
IsValid(ReadOnlySpan<Char>) |
驗證指定的文字範圍是由有效的base-64編碼數據所組成。 |
IsValid(ReadOnlySpan<Byte>, Int32) |
驗證UTF-8文字的指定範圍是由有效的base-64編碼數據所組成。 |
IsValid(ReadOnlySpan<Char>, Int32) |
驗證指定的文字範圍是由有效的base-64編碼數據所組成。 |
IsValid(ReadOnlySpan<Byte>)
驗證UTF-8文字的指定範圍是由有效的base-64編碼數據所組成。
public:
static bool IsValid(ReadOnlySpan<System::Byte> base64TextUtf8);
public static bool IsValid (ReadOnlySpan<byte> base64TextUtf8);
static member IsValid : ReadOnlySpan<byte> -> bool
Public Shared Function IsValid (base64TextUtf8 As ReadOnlySpan(Of Byte)) As Boolean
參數
- base64TextUtf8
- ReadOnlySpan<Byte>
要驗證的UTF-8文字範圍。
傳回
true
如果 base64TextUtf8
包含 base-64 編碼資料的有效可譯碼序列,則為 , false
否則為 。
備註
如果方法傳 true
回 ,則傳遞至 DecodeFromUtf8(ReadOnlySpan<Byte>, Span<Byte>, Int32, Int32, Boolean) 和 DecodeFromUtf8InPlace(Span<Byte>, Int32) 的相同文字會成功譯碼。 輸入中允許任意數量的空格符,其中空格元定義為字元 ''、'\t'、'\r' 或 '\n' (為位元組) 。
適用於
IsValid(ReadOnlySpan<Char>)
驗證指定的文字範圍是由有效的base-64編碼數據所組成。
public:
static bool IsValid(ReadOnlySpan<char> base64Text);
public static bool IsValid (ReadOnlySpan<char> base64Text);
static member IsValid : ReadOnlySpan<char> -> bool
Public Shared Function IsValid (base64Text As ReadOnlySpan(Of Char)) As Boolean
參數
- base64Text
- ReadOnlySpan<Char>
要驗證的文字範圍。
傳回
true
如果 base64Text
包含 base-64 編碼資料的有效可譯碼序列,則為 , false
否則為 。
備註
如果方法傳 true
回 ,則傳遞至 FromBase64String(String) 和 TryFromBase64Chars(ReadOnlySpan<Char>, Span<Byte>, Int32) 的相同文字會在假設有足夠的輸出空間) 的情況下 TryFromBase64Chars(ReadOnlySpan<Char>, Span<Byte>, Int32) 成功譯碼 (。 輸入中的任何位置允許任意數量的空格符,其中空格元定義為字元 '、'\t'、'\r' 或 '\n'。
適用於
IsValid(ReadOnlySpan<Byte>, Int32)
驗證UTF-8文字的指定範圍是由有效的base-64編碼數據所組成。
public:
static bool IsValid(ReadOnlySpan<System::Byte> base64TextUtf8, [Runtime::InteropServices::Out] int % decodedLength);
public static bool IsValid (ReadOnlySpan<byte> base64TextUtf8, out int decodedLength);
static member IsValid : ReadOnlySpan<byte> * int -> bool
Public Shared Function IsValid (base64TextUtf8 As ReadOnlySpan(Of Byte), ByRef decodedLength As Integer) As Boolean
參數
- base64TextUtf8
- ReadOnlySpan<Byte>
要驗證的UTF-8文字範圍。
- decodedLength
- Int32
如果方法傳 true
回 ,則譯碼的位元組數目會從譯碼輸入UTF-8文字所產生。
傳回
true
如果 base64TextUtf8
包含 base-64 編碼資料的有效可譯碼序列,則為 , false
否則為 。
備註
如果方法傳 true
回 ,則傳遞至 DecodeFromUtf8(ReadOnlySpan<Byte>, Span<Byte>, Int32, Int32, Boolean) 和 DecodeFromUtf8InPlace(Span<Byte>, Int32) 的相同文字會成功譯碼。 輸入中允許任意數量的空格符,其中空格元定義為字元 ''、'\t'、'\r' 或 '\n' (為位元組) 。
適用於
IsValid(ReadOnlySpan<Char>, Int32)
驗證指定的文字範圍是由有效的base-64編碼數據所組成。
public:
static bool IsValid(ReadOnlySpan<char> base64Text, [Runtime::InteropServices::Out] int % decodedLength);
public static bool IsValid (ReadOnlySpan<char> base64Text, out int decodedLength);
static member IsValid : ReadOnlySpan<char> * int -> bool
Public Shared Function IsValid (base64Text As ReadOnlySpan(Of Char), ByRef decodedLength As Integer) As Boolean
參數
- base64Text
- ReadOnlySpan<Char>
要驗證的文字範圍。
- decodedLength
- Int32
如果方法傳 true
回 ,則為譯碼的位元組數目,這是譯碼輸入文字所產生的位元組數目。
傳回
true
如果 base64Text
包含 base-64 編碼資料的有效可譯碼序列,則為 , false
否則為 。
備註
如果方法傳 true
回 ,則傳遞至 FromBase64String(String) 和 TryFromBase64Chars(ReadOnlySpan<Char>, Span<Byte>, Int32) 的相同文字會在假設有足夠的輸出空間) 的情況下 TryFromBase64Chars(ReadOnlySpan<Char>, Span<Byte>, Int32) 成功譯碼 (。 輸入中的任何位置允許任意數量的空格符,其中空格元定義為字元 '、'\t'、'\r' 或 '\n'。