MemoryExtensions.Split 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
Split(ReadOnlySpan<Char>, Span<Range>, Char, StringSplitOptions) |
Parses the source ReadOnlySpan<T> for the specified |
Split(ReadOnlySpan<Char>, Span<Range>, ReadOnlySpan<Char>, StringSplitOptions) |
Parses the source ReadOnlySpan<T> for the specified |
Split<T>(ReadOnlySpan<T>, ReadOnlySpan<T>) |
Returns a type that allows for enumeration of each element within a split span using the provided separator span. |
Split<T>(ReadOnlySpan<T>, T) |
Returns a type that allows for enumeration of each element within a split span using the provided separator character. |
Split(ReadOnlySpan<Char>, Span<Range>, Char, StringSplitOptions)
- Source:
- MemoryExtensions.cs
- Source:
- MemoryExtensions.cs
Parses the source ReadOnlySpan<T> for the specified separator
, populating the destination
span with Range instances representing the regions between the separators.
public static int Split (this ReadOnlySpan<char> source, Span<Range> destination, char separator, StringSplitOptions options = System.StringSplitOptions.None);
static member Split : ReadOnlySpan<char> * Span<Range> * char * StringSplitOptions -> int
<Extension()>
Public Function Split (source As ReadOnlySpan(Of Char), destination As Span(Of Range), separator As Char, Optional options As StringSplitOptions = System.StringSplitOptions.None) As Integer
Parameters
- source
- ReadOnlySpan<Char>
The source span to parse.
- separator
- Char
A character that delimits the regions in this instance.
- options
- StringSplitOptions
A bitwise combination of the enumeration values that specifies whether to trim whitespace and include empty ranges.
Returns
The number of ranges written into destination
.
Remarks
Delimiter characters are not included in the elements of the returned array.
If the destination
span is empty, or if the options
specifies RemoveEmptyEntries and source
is empty, or if options
specifies both RemoveEmptyEntries and TrimEntries and the source
is entirely whitespace, no ranges are written to the destination.
If the span does not contain separator
, or if destination
's length is 1, a single range will be output containing the entire source
, subject to the processing implied by options
.
If there are more regions in source
than will fit in destination
, the first destination
length minus 1 ranges are stored in destination
, and a range for the remainder of source
is stored in destination
.
Applies to
Split(ReadOnlySpan<Char>, Span<Range>, ReadOnlySpan<Char>, StringSplitOptions)
- Source:
- MemoryExtensions.cs
- Source:
- MemoryExtensions.cs
Parses the source ReadOnlySpan<T> for the specified separator
, populating the destination
span with Range instances representing the regions between the separators.
public static int Split (this ReadOnlySpan<char> source, Span<Range> destination, ReadOnlySpan<char> separator, StringSplitOptions options = System.StringSplitOptions.None);
static member Split : ReadOnlySpan<char> * Span<Range> * ReadOnlySpan<char> * StringSplitOptions -> int
<Extension()>
Public Function Split (source As ReadOnlySpan(Of Char), destination As Span(Of Range), separator As ReadOnlySpan(Of Char), Optional options As StringSplitOptions = System.StringSplitOptions.None) As Integer
Parameters
- source
- ReadOnlySpan<Char>
The source span to parse.
- separator
- ReadOnlySpan<Char>
A character that delimits the regions in this instance.
- options
- StringSplitOptions
A bitwise combination of the enumeration values that specifies whether to trim whitespace and include empty ranges.
Returns
The number of ranges written into destination
.
Remarks
Delimiter characters are not included in the elements of the returned array.
If the destination
span is empty, or if the options
specifies RemoveEmptyEntries and source
is empty, or if options
specifies both RemoveEmptyEntries and TrimEntries and the source
is entirely whitespace, no ranges are written to the destination.
If the span does not contain separator
, or if destination
's length is 1, a single range will be output containing the entire source
, subject to the processing implied by options
.
If there are more regions in source
than will fit in destination
, the first destination
length minus 1 ranges are stored in destination
, and a range for the remainder of source
is stored in destination
.
Applies to
Split<T>(ReadOnlySpan<T>, ReadOnlySpan<T>)
Returns a type that allows for enumeration of each element within a split span using the provided separator span.
public:
generic <typename T>
where T : IEquatable<T>[System::Runtime::CompilerServices::Extension]
static MemoryExtensions::SpanSplitEnumerator<T> Split(ReadOnlySpan<T> source, ReadOnlySpan<T> separator);
public static MemoryExtensions.SpanSplitEnumerator<T> Split<T> (this ReadOnlySpan<T> source, ReadOnlySpan<T> separator) where T : IEquatable<T>;
static member Split : ReadOnlySpan<'T (requires 'T :> IEquatable<'T>)> * ReadOnlySpan<'T (requires 'T :> IEquatable<'T>)> -> MemoryExtensions.SpanSplitEnumerator<'T (requires 'T :> IEquatable<'T>)> (requires 'T :> IEquatable<'T>)
<Extension()>
Public Function Split(Of T As IEquatable(Of T)) (source As ReadOnlySpan(Of T), separator As ReadOnlySpan(Of T)) As MemoryExtensions.SpanSplitEnumerator(Of T)
Type Parameters
- T
The type of the elements.
Parameters
- source
- ReadOnlySpan<T>
The source span to be enumerated.
- separator
- ReadOnlySpan<T>
The separator span to be used to split the provided span.
Returns
An enumerator that can be used to enumerate each element in a split span using the provided separator span.
Applies to
Split<T>(ReadOnlySpan<T>, T)
Returns a type that allows for enumeration of each element within a split span using the provided separator character.
public:
generic <typename T>
where T : IEquatable<T>[System::Runtime::CompilerServices::Extension]
static MemoryExtensions::SpanSplitEnumerator<T> Split(ReadOnlySpan<T> source, T separator);
public static MemoryExtensions.SpanSplitEnumerator<T> Split<T> (this ReadOnlySpan<T> source, T separator) where T : IEquatable<T>;
static member Split : ReadOnlySpan<'T (requires 'T :> IEquatable<'T>)> * 'T -> MemoryExtensions.SpanSplitEnumerator<'T (requires 'T :> IEquatable<'T>)> (requires 'T :> IEquatable<'T>)
<Extension()>
Public Function Split(Of T As IEquatable(Of T)) (source As ReadOnlySpan(Of T), separator As T) As MemoryExtensions.SpanSplitEnumerator(Of T)
Type Parameters
- T
The type of the elements.
Parameters
- source
- ReadOnlySpan<T>
The source span to be enumerated.
- separator
- T
The separator character to be used to split the provided span.
Returns
An enumerator that can be used to enumerate each element in a split span using the provided separator character.