Base64.IsValid Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
IsValid(ReadOnlySpan<Byte>) |
Validates that the specified span of UTF-8 text is comprised of valid base-64 encoded data. |
IsValid(ReadOnlySpan<Char>) |
Validates that the specified span of text is comprised of valid base-64 encoded data. |
IsValid(ReadOnlySpan<Byte>, Int32) |
Validates that the specified span of UTF-8 text is comprised of valid base-64 encoded data. |
IsValid(ReadOnlySpan<Char>, Int32) |
Validates that the specified span of text is comprised of valid base-64 encoded data. |
IsValid(ReadOnlySpan<Byte>)
- Source:
- Base64Validator.cs
- Source:
- Base64Validator.cs
Validates that the specified span of UTF-8 text is comprised of valid base-64 encoded data.
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
Parameters
- base64TextUtf8
- ReadOnlySpan<Byte>
A span of UTF-8 text to validate.
Returns
true
if base64TextUtf8
contains a valid, decodable sequence of base-64 encoded data; otherwise, false
.
Remarks
If the method returns true
, the same text passed to DecodeFromUtf8(ReadOnlySpan<Byte>, Span<Byte>, Int32, Int32, Boolean) and DecodeFromUtf8InPlace(Span<Byte>, Int32) would successfully decode. Any amount of whitespace is allowed anywhere in the input, where whitespace is defined as the characters ' ', '\t', '\r', or '\n' (as bytes).
Applies to
IsValid(ReadOnlySpan<Char>)
- Source:
- Base64Validator.cs
- Source:
- Base64Validator.cs
Validates that the specified span of text is comprised of valid base-64 encoded data.
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
Parameters
- base64Text
- ReadOnlySpan<Char>
A span of text to validate.
Returns
true
if base64Text
contains a valid, decodable sequence of base-64 encoded data; otherwise, false
.
Remarks
If the method returns true
, the same text passed to FromBase64String(String) and TryFromBase64Chars(ReadOnlySpan<Char>, Span<Byte>, Int32) would successfully decode (in the case of TryFromBase64Chars(ReadOnlySpan<Char>, Span<Byte>, Int32) assuming sufficient output space). Any amount of whitespace is allowed anywhere in the input, where whitespace is defined as the characters ' ', '\t', '\r', or '\n'.
Applies to
IsValid(ReadOnlySpan<Byte>, Int32)
- Source:
- Base64Validator.cs
- Source:
- Base64Validator.cs
Validates that the specified span of UTF-8 text is comprised of valid base-64 encoded data.
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
Parameters
- base64TextUtf8
- ReadOnlySpan<Byte>
A span of UTF-8 text to validate.
- decodedLength
- Int32
If the method returns true
, the number of decoded bytes that will result from decoding the input UTF-8 text.
Returns
true
if base64TextUtf8
contains a valid, decodable sequence of base-64 encoded data; otherwise, false
.
Remarks
If the method returns true
, the same text passed to DecodeFromUtf8(ReadOnlySpan<Byte>, Span<Byte>, Int32, Int32, Boolean) and DecodeFromUtf8InPlace(Span<Byte>, Int32) would successfully decode. Any amount of whitespace is allowed anywhere in the input, where whitespace is defined as the characters ' ', '\t', '\r', or '\n' (as bytes).
Applies to
IsValid(ReadOnlySpan<Char>, Int32)
- Source:
- Base64Validator.cs
- Source:
- Base64Validator.cs
Validates that the specified span of text is comprised of valid base-64 encoded data.
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
Parameters
- base64Text
- ReadOnlySpan<Char>
A span of text to validate.
- decodedLength
- Int32
If the method returns true
, the number of decoded bytes that will result from decoding the input text.
Returns
true
if base64Text
contains a valid, decodable sequence of base-64 encoded data; otherwise, false
.
Remarks
If the method returns true
, the same text passed to FromBase64String(String) and TryFromBase64Chars(ReadOnlySpan<Char>, Span<Byte>, Int32) would successfully decode (in the case of TryFromBase64Chars(ReadOnlySpan<Char>, Span<Byte>, Int32) assuming sufficient output space). Any amount of whitespace is allowed anywhere in the input, where whitespace is defined as the characters ' ', '\t', '\r', or '\n'.