MemoryExtensions.Trim 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
| Name | Description |
|---|---|
| Trim(ReadOnlySpan<Char>) |
Removes all leading and trailing whitespace characters from a read-only character span. |
| Trim(ReadOnlySpan<Char>, Char) |
Removes all leading and trailing occurrences of a specified character from a read-only character span. |
| Trim(ReadOnlySpan<Char>, ReadOnlySpan<Char>) |
Removes all leading and trailing occurrences of a set of characters specified in a read-only span from a read-only character span. |
Trim(ReadOnlySpan<Char>)
Removes all leading and trailing whitespace characters from a read-only character span.
public:
[System::Runtime::CompilerServices::Extension]
static ReadOnlySpan<char> Trim(ReadOnlySpan<char> span);
public static ReadOnlySpan<char> Trim(this ReadOnlySpan<char> span);
static member Trim : ReadOnlySpan<char> -> ReadOnlySpan<char>
<Extension()>
Public Function Trim (span As ReadOnlySpan(Of Char)) As ReadOnlySpan(Of Char)
Parameters
- span
- ReadOnlySpan<Char>
The source span from which the characters are removed.
Returns
The trimmed read-only character span.
Applies to
Trim(ReadOnlySpan<Char>, Char)
Removes all leading and trailing occurrences of a specified character from a read-only character span.
public:
[System::Runtime::CompilerServices::Extension]
static ReadOnlySpan<char> Trim(ReadOnlySpan<char> span, char trimChar);
public static ReadOnlySpan<char> Trim(this ReadOnlySpan<char> span, char trimChar);
static member Trim : ReadOnlySpan<char> * char -> ReadOnlySpan<char>
<Extension()>
Public Function Trim (span As ReadOnlySpan(Of Char), trimChar As Char) As ReadOnlySpan(Of Char)
Parameters
- span
- ReadOnlySpan<Char>
The source span from which the character is removed.
- trimChar
- Char
The specified character to look for and remove.
Returns
The trimmed read-only character span.
Applies to
Trim(ReadOnlySpan<Char>, ReadOnlySpan<Char>)
Removes all leading and trailing occurrences of a set of characters specified in a read-only span from a read-only character span.
public:
[System::Runtime::CompilerServices::Extension]
static ReadOnlySpan<char> Trim(ReadOnlySpan<char> span, ReadOnlySpan<char> trimChars);
public static ReadOnlySpan<char> Trim(this ReadOnlySpan<char> span, ReadOnlySpan<char> trimChars);
static member Trim : ReadOnlySpan<char> * ReadOnlySpan<char> -> ReadOnlySpan<char>
<Extension()>
Public Function Trim (span As ReadOnlySpan(Of Char), trimChars As ReadOnlySpan(Of Char)) As ReadOnlySpan(Of Char)
Parameters
- span
- ReadOnlySpan<Char>
The source span from which the characters are removed.
- trimChars
- ReadOnlySpan<Char>
The span which contains the set of characters to remove.
Returns
The trimmed read-only character span.
Remarks
If trimChars is empty, whitespace characters are removed instead.