Base64.IsValid 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
| 名稱 | Description |
|---|---|
| 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 包含有效且可解碼的 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 包含有效且可解碼的 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 包含有效且可解碼的 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 包含有效且可解碼的 64 進位編碼資料序列;否則, false。
備註
若方法返回 true,相同的文字會傳遞至 FromBase64String(String) , TryFromBase64Chars(ReadOnlySpan<Char>, Span<Byte>, Int32) 且在假設輸出空間足夠的情況下,將成功解碼 TryFromBase64Chars(ReadOnlySpan<Char>, Span<Byte>, Int32) 。 輸入中允許任意空白,空白定義為字元「'」、「\t」、「\r」或「\n」。