SpanPolyfillExtension Class

Extension methods for the Span<Char> struct used in the .NET Framework, .NET Standard 2.0, and .NET Standard 2.1 as polyfills for methods from current .NET versions.

Definition

Namespace: FolkerKinzel.Strings
Assembly: FolkerKinzel.Strings (in FolkerKinzel.Strings.dll) Version: 9.4.0+10a7d4d71aa960998e32ac0ac6c4fcbe4164c917
C#
public static class SpanPolyfillExtension
Inheritance
Object    SpanPolyfillExtension

Remarks

The methods of this class should only be used in the extension method syntax to simulate the methods of the Span<Char> struct, which exist in current frameworks.

Methods

CommonPrefixLength(SpanChar, ReadOnlySpanChar)Determines the length of any common prefix shared between span and other.
CommonPrefixLength(SpanChar, String)Determines the length of any common prefix shared between span and other.
CommonPrefixLength(SpanChar, ReadOnlySpanChar, IEqualityComparerChar)Determines the length of any common prefix shared between span and other.
CommonPrefixLength(SpanChar, String, IEqualityComparerChar)Determines the length of any common prefix shared between span and other.
Contains(SpanChar, Char)Indicates whether a character span contains a specified Unicode character.
Contains(SpanChar, String, StringComparison)Indicates whether a specified value occurs within a character span when compared using a specified StringComparison value.
ContainsAny(SpanChar, SearchValuesPolyfillChar) Searches for an occurrence of any of the specified characters and returns true if found. If not found, returns false.
ContainsAny(SpanChar, ReadOnlySpanChar)Indicates whether a character span contains one of the Unicode characters that are passed to the method as a read-only character span.
ContainsAny(SpanChar, String)Indicates whether a character span contains one of the Unicode characters that are passed to the method as a string.
ContainsAny(SpanChar, Char, Char)Indicates whether a character span contains one of the two characters that are passed to the method as arguments.
ContainsAny(SpanChar, Char, Char, Char)Indicates whether a character span contains one of the three characters that are passed to the method as arguments.
ContainsAnyExcept(SpanChar, SearchValuesPolyfillChar) Searches for any character other than the specified values.
ContainsAnyExcept(SpanChar, Char)Searches for any character other than value.
ContainsAnyExcept(SpanChar, ReadOnlySpanChar)Searches for any character other than the specified values.
ContainsAnyExcept(SpanChar, String)Searches for any character other than the specified values.
ContainsAnyExcept(SpanChar, Char, Char)Searches for any character other than value0 or value1.
ContainsAnyExcept(SpanChar, Char, Char, Char)Indicates whether a character span contains one of the three characters that are passed to the method as arguments.
ContainsAnyInRange Searches for any value in the range between lowInclusive and highInclusive, inclusive.
EndsWith(SpanChar, String)Indicates whether a character span ends with the specified String.
EndsWith(SpanChar, String, StringComparison)Indicates whether a character span ends with a specified String when compared using a specified StringComparison value.
EqualsDetermines whether this span and the specified other other String have the same characters when compared using the specified comparisonType option.
IndexOf Reports the zero-based index of the first occurrence of the specified value in the current span.
IndexOfAny(SpanChar, SearchValuesPolyfillChar) Searches for the zero-based index of the first occurrence of one of the specified Unicode characters.
IndexOfAny(SpanChar, ReadOnlySpanChar)Searches for the zero-based index of the first occurrence of one of the specified Unicode characters.
IndexOfAny(SpanChar, String)Searches for the zero-based index of the first occurrence of one of the specified Unicode characters.
IndexOfAnyExcept(SpanChar, SearchValuesPolyfillChar) Searches for the first index of any character other than the specified values.
IndexOfAnyExcept(SpanChar, Char)Returns the index of the first character in the span that is not equal to value.
IndexOfAnyExcept(SpanChar, ReadOnlySpanChar) Searches for the first index of any character other than the specified values.
IndexOfAnyExcept(SpanChar, String) Searches for the first index of any character other than the specified values.
IndexOfAnyExcept(SpanChar, Char, Char) Searches for the first index of any character other than the specified value0 or value1.
IndexOfAnyExcept(SpanChar, Char, Char, Char) Searches for the first index of any character other than the specified value0, value1, or value2.
IndexOfAnyExceptInRange Searches for the first index of any value outside of the range between lowInclusive and highInclusive, inclusive.
IndexOfAnyInRange Searches for the first index of any value in the range between lowInclusive and highInclusive, inclusive.
LastIndexOf(SpanChar, String, StringComparison)Specifies the zero-based index of the last occurrence of a specified string in span. A parameter specifies the type of search for the specified string.
LastIndexOf(SpanChar, String, Int32, Int32, StringComparison)Specifies the zero based index position of the last occurrence of a specified character sequence in span. The search begins at a specified character position and runs backwards to the beginning of the character span for a specified number of character positions. A parameter specifies the type of comparison to be performed when searching for the specified character sequence.
LastIndexOfAny(SpanChar, SearchValuesPolyfillChar) Searches for the last index of any of the specified Unicode characters.
LastIndexOfAny(SpanChar, ReadOnlySpanChar)Searches for the zero-based index of the last occurrence of one of the specified Unicode characters.
LastIndexOfAny(SpanChar, String)Searches for the zero-based index of the last occurrence of one of the specified Unicode characters.
LastIndexOfAny(SpanChar, String, Int32, Int32)Returns the zero-based index of the last occurrence of one of the specified characters in span. The search begins at a specified character position and runs a specified number of character positions backwards to the beginning of the span.
LastIndexOfAnyExcept(SpanChar, SearchValuesPolyfillChar) Searches for the last index of any character other than the specified values.
LastIndexOfAnyExcept(SpanChar, Char)Returns the index of the last character in the span that is not equal to value.
LastIndexOfAnyExcept(SpanChar, ReadOnlySpanChar) Searches for the last index of any character other than the specified values.
LastIndexOfAnyExcept(SpanChar, String) Searches for the last index of any character other than the specified values.
LastIndexOfAnyExcept(SpanChar, Char, Char) Searches for the last index of any character other than the specified value0 or value1.
LastIndexOfAnyExcept(SpanChar, Char, Char, Char) Searches for the last index of any character other than the specified value0, value1, or value2.
LastIndexOfAnyExceptInRange Searches for the last index of any value outside of the range between lowInclusive and highInclusive, inclusive.
LastIndexOfAnyInRange Searches for the last index of any value in the range between lowInclusive and highInclusive, inclusive.
StartsWith(SpanChar, String)Indicates whether a read-only character span begins with a specified String.
StartsWith(SpanChar, String, StringComparison)Indicates whether a character span begins with a specified String when compared using a specified StringComparison value.
Trim(SpanChar)Removes all leading and trailing white space characters from a character span.
Trim(SpanChar, Char)Removes all leading and trailing occurrences of trimElement from a character span.
Trim(SpanChar, ReadOnlySpanChar)Removes all leading and trailing occurrences of a set of characters specified in a read-only span from a character span.
Trim(SpanChar, String)Removes all leading and trailing occurrences of a set of characters specified in a String from a character span.
TrimEnd(SpanChar)Removes all trailing white space characters from a character span.
TrimEnd(SpanChar, Char)Removes all trailing occurrences of trimElement from a character span.
TrimEnd(SpanChar, ReadOnlySpanChar)Removes all trailing occurrences of a set of characters specified in a read-only span from a character span.
TrimEnd(SpanChar, String)Removes all trailing occurrences of a set of characters specified in a String from a character span.
TrimStart(SpanChar)Removes all leading white space characters from a character span.
TrimStart(SpanChar, Char)Removes all leading occurrences of trimElement from a character span.
TrimStart(SpanChar, ReadOnlySpanChar)Removes all leading occurrences of a set of characters specified in a read-only span from a character span.
TrimStart(SpanChar, String)Removes all leading occurrences of a set of characters specified in a String from a character span.

See Also