Class SpanExtensions
public static class SpanExtensions
- Inheritance
-
SpanExtensions
- Inherited Members
Methods
Concat(ReadOnlySpan<char>, char, ReadOnlySpan<char>)
Concat 2 spans without allocating extra memory.
public static string Concat(this ReadOnlySpan<char> span, char combine, ReadOnlySpan<char> span2)
Parameters
spanReadOnlySpan<char>combinecharspan2ReadOnlySpan<char>
Returns
Concat(ReadOnlySpan<char>, char, ReadOnlySpan<char>, ReadOnlySpan<char>)
Concat 3 spans without allocating extra memory.
public static string Concat(this ReadOnlySpan<char> span, char span2, ReadOnlySpan<char> span3, ReadOnlySpan<char> span4)
Parameters
spanReadOnlySpan<char>span2charspan3ReadOnlySpan<char>span4ReadOnlySpan<char>
Returns
Concat(ReadOnlySpan<char>, ReadOnlySpan<char>)
Concat 2 spans without allocating extra memory.
public static string Concat(this ReadOnlySpan<char> span, ReadOnlySpan<char> span2)
Parameters
spanReadOnlySpan<char>span2ReadOnlySpan<char>
Returns
Concat(ReadOnlySpan<char>, ReadOnlySpan<char>, ReadOnlySpan<char>)
Concat 3 spans without allocating extra memory.
public static string Concat(this ReadOnlySpan<char> span, ReadOnlySpan<char> span2, ReadOnlySpan<char> span3)
Parameters
spanReadOnlySpan<char>span2ReadOnlySpan<char>span3ReadOnlySpan<char>
Returns
Concat(ReadOnlySpan<char>, string)
Concat a span and string without allocating extra memory.
public static string Concat(this ReadOnlySpan<char> span, string str)
Parameters
spanReadOnlySpan<char>strstring
Returns
Count<T>(ReadOnlySpan<T>, ReadOnlySpan<T>)
Counts the number of occurences of value in span.
public static int Count<T>(this ReadOnlySpan<T> span, ReadOnlySpan<T> value) where T : IEquatable<T>
Parameters
spanReadOnlySpan<T>valueReadOnlySpan<T>
Returns
Type Parameters
T
Count<T>(ReadOnlySpan<T>, T)
Counts the number of occurences of value in span.
public static int Count<T>(this ReadOnlySpan<T> span, T value) where T : IEquatable<T>
Parameters
spanReadOnlySpan<T>valueT
Returns
Type Parameters
T
IndexOf<T>(ReadOnlySpan<T>, ReadOnlySpan<T>, int)
Gets the index of an object in a span with an offset.
public static int IndexOf<T>(this ReadOnlySpan<T> span, ReadOnlySpan<T> value, int startIndex) where T : IEquatable<T>
Parameters
spanReadOnlySpan<T>valueReadOnlySpan<T>startIndexint
Returns
Type Parameters
T
IndexOf<T>(ReadOnlySpan<T>, T, int)
Gets the index of an object in a span with an offset.
public static int IndexOf<T>(this ReadOnlySpan<T> span, T value, int startIndex) where T : IEquatable<T>
Parameters
spanReadOnlySpan<T>valueTstartIndexint
Returns
Type Parameters
T
Split(ReadOnlySpan<char>, Span<Range>, char, bool, bool, StringSplitOptions)
Span implementation of Split(char, StringSplitOptions). (this exists but only in .net 8+)
public static int Split(this ReadOnlySpan<char> span, Span<Range> ranges, char separator, bool trimOuter = false, bool trimEachEntry = false, StringSplitOptions options = StringSplitOptions.None)
Parameters
spanReadOnlySpan<char>rangesSpan<Range>separatorchartrimOuterboolTrim white-space off the input string before splitting.
trimEachEntryboolTrim white-space off each split entry.
optionsStringSplitOptions
Returns
Remarks
Will return as many ranges as ranges can fit. To get a maximum, use span.Count(.separator) + 1