MemoryExtensions.Split Method (System) (original) (raw)
Source:
Source:
Source:
Parses the source ReadOnlySpan 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
destination
The destination span into which the resulting ranges are written.
separator
A character that delimits the regions in this instance.
options
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
.