StringExtensions Class

Provides extension methods for the string type.

Definition

Namespace: KGySoft.CoreLibraries
Assembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 9.0.0-preview.1
C#
public static class StringExtensions
Inheritance
Object    StringExtensions

Methods

AsSegment(String) Gets the specified string as a StringSegment instance.
AsSegment(String, Int32) Gets a StringSegment instance, which represents a segment of the specified string. No new string allocation occurs when using this method.
AsSegment(String, Int32, Int32) Gets a StringSegment instance, which represents a segment of the specified string. No new string allocation occurs when using this method.
Contains Gets whether the specified string s contains the specified value using the specified comparison.
ContainsAny(String, String) Gets whether the specified String s contains any of the strings in the specified set by case sensitive ordinal comparison.
ContainsAny(String, StringComparison, String) Gets whether the specified String s contains any of the strings in the specified set set using a specific comparison.
EqualsAny(String, String) Gets whether the specified string s equals any of the strings in the specified set set by case sensitive ordinal comparison.
EqualsAny(String, StringComparer, String) Gets whether the specified string s equals any of the strings in the specified set set using a specific comparer.
EqualsAny(String, StringComparison, String) Gets whether the specified String s equals any of the strings in the specified set set using a specific comparison.
IndexOfAny(String, String) Gets the zero-based index of the first occurrence in the specified String s of any of the strings in the specified set by case sensitive ordinal comparison.
IndexOfAny(String, StringComparison, String) Gets the zero-based index of the first occurrence in the specified String s of any of the strings in the specified set using a specific comparison.
Parse(String, Type, CultureInfo) Parses an object from a string value. Firstly, it tries to parse the type natively. If type cannot be parsed natively but the type has a TypeConverter or a registered conversion that can convert from string, then the type converter or conversion will be used.
See the Remarks section of the ParseT(String, CultureInfo) overload for details.
ParseT(String, CultureInfo) Parses an object of type T from a string value. Firstly, it tries to parse the type natively. If T cannot be parsed natively but the type has a TypeConverter or a registered conversion that can convert from string, then the type converter or conversion will be used.
ParseDecimalBytes Parses separated decimal bytes from a string.
ParseHexBytes(String) Parses a continuous hex stream from a string.
ParseHexBytes(String, String) Parses delimited hex values from a string into an array of bytes.
RemoveQuotes Extracts content of a single or double quoted string.
Repeat Repeats a String count times.
ToEnumTEnum Tries to convert the specified string to an Enum value of TEnum type.
ToWildcardsRegex Converts the passed string to a Regex that matches wildcard characters (? and *).
TryParse(String, Type, Object) Tries to parse an object of type type from a string value. Firstly, it tries to parse the type natively. If type cannot be parsed natively but the type has a TypeConverter or a registered conversion that can convert from string, then the type converter or conversion will be used.
See the Remarks section of the ParseT(String, CultureInfo) method for details.
TryParse(String, Type, CultureInfo, Object) Tries to parse an object of type type from a string value. Firstly, it tries to parse the type natively. If type cannot be parsed natively but the type has a TypeConverter or a registered conversion that can convert from string, then the type converter or conversion will be used.
See the Remarks section of the ParseT(String, CultureInfo) method for details.
TryParseT(String, T) Tries to parse an object of type T from a string value. Firstly, it tries to parse the type natively. If T cannot be parsed natively but the type has a TypeConverter or a registered conversion that can convert from string, then the type converter or conversion will be used.
See the Remarks section of the ParseT(String, CultureInfo) method for details.
TryParseT(String, CultureInfo, T) Tries to parse an object of type T from a string value. Firstly, it tries to parse the type natively. If T cannot be parsed natively but the type has a TypeConverter or a registered conversion that can convert from string, then the type converter or conversion will be used.
See the Remarks section of the ParseT(String, CultureInfo) method for details.

See Also