StringPolyfillExtension Class

Extension methods for the String class, which are used 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 StringPolyfillExtension
Inheritance
Object    StringPolyfillExtension

Remarks

To match the behavior of the original methods, these extension methods throw a NullReferenceException when called on a null string.

Methods

Contains(String, Char)Returns a value indicating whether a specified character appears in the String.
Contains(String, Char, StringComparison)Returns a value indicating whether a specified character occurs within this String, using the specified comparison rules.
Contains(String, String, StringComparison)Returns a value indicating whether a specified String occurs within s, using the specified comparison rules.
EndsWithIndicates whether the end of s matches the specified character.
IndexOfReturns the zero-based index of the first occurrence of the specified Unicode character in this String. A parameter specifies the type of search to use for the specified character.
ReplaceReturns a new String in which all occurrences of a specified String in the current String are replaced with another specified String, using the provided comparison type.
ReplaceLineEndings(String)Replaces all newlines in s with NewLine.
ReplaceLineEndings(String, String)Replaces all newlines in s with replacementText.
Split(String, Char, StringSplitOptions)Splits a String into substrings based on a specified delimiting character and, optionally, options.
Split(String, String, StringSplitOptions)Splits a String into substrings based on the provided separator, optionally omitting empty substrings from the result.
Split(String, Char, Int32, StringSplitOptions)Splits a String into a maximum number of substrings based on the provided character separator, optionally omitting empty substrings from the result.
Split(String, String, Int32, StringSplitOptions)Splits a String into a maximum number of substrings based on the provided separator, optionally omitting empty substrings from the result.
StartsWithIndicates whether s starts with the specified character.
Trim(String, ReadOnlySpanChar)Generates a String from which all leading and trailing occurrences of the characters in the specified read-only span are removed.
Trim(String, String)Generates a String from which all leading and trailing occurrences of the characters in the specified read-only span are removed.
TrimEnd(String, ReadOnlySpanChar)Generates a String from which all trailing occurrences of the characters in the specified read-only span are removed.
TrimEnd(String, String)Generates a String from which all trailing occurrences of the characters in the specified read-only span are removed.
TrimStart(String, ReadOnlySpanChar)Generates a String from which all leading occurrences of the characters in the specified read-only span are removed.
TrimStart(String, String)Generates a String from which all leading occurrences of the characters in the specified read-only span are removed.

See Also