Safely trim a System.String
, returns string.Empty
in case of null
.
Overloads
Removes all leading and trailing white-space characters from the current System.String
object, returns string.Empty
in case of null
.
public static string SafeTrim(this string text);
this is shortcut to:
return (text ?? string.Empty).Trim()
Removes all leading and trailing occurrences of a set of characters specified in an array from the current System.String
object, returns string.Empty
in case of null
.
public static string SafeTrim(this string text, params char[] trimChars);
this is shortcut to:
return (text ?? string.Empty).Trim(trimChars)
Determines whether a System.String
has same value to another System.String
.
Overloads
Determines whether a System.String
has same value to another System.String
using StringComparison.CurrentCulture
.
public static string IsEqual(this string a, string b);
Determines whether a System.String
has same value to another System.String
using StringComparison.CurrentCulture
with option to ignore case.
public static string IsEqual(this string a, string b, bool ignoreCase);
Determines whether a System.String
has same value to another System.String
using specified StringComparison
.
public static string IsEqual(this string a, string b, StringComparison stringComparison);
Determines whether a System.String
has same value to another System.String
using StringComparison.Ordinal
.
public static string IsOrdinalEqual(this string a, string b);
Determines whether a System.String
has same value to another System.String
using StringComparison.Ordinal
with option to ignore case.
public static string IsOrdinalEqual(this string a, string b, bool ignoreCase);
Determines whether a System.String
has same value (ignore trailing and leading spaces) to another System.String
using StringComparison.CurrentCulture
.
public static string IsEqualIgnoreSpaces(this string a, string b);
Determines whether a System.String
has same value (ignore trailing and leading spaces) to another System.String
using StringComparison.CurrentCulture
with option to ignore case.
public static string IsEqualIgnoreSpaces(this string a, string b, bool ignoreCase);
Determines whether a System.String
has same value (ignore trailing and leading spaces) to another System.String
using a specified StringComparison
.
public static string IsEqualIgnoreSpaces(this string a, string b, StringComparison stringComparison);
Determines whether a System.String
has same value (ignore trailing and leading spaces) to another System.String
using StringComparison.Ordinal
.
public static string IsOrdinalEqualIgnoreSpaces(this string a, string b);
Determines whether a System.String
has same value (ignore trailing and leading spaces) to another System.String
using StringComparison.Ordinal
with option to ignore case.
public static string IsOrdinalEqualIgnoreSpaces(this string a, string b, bool ignoreCase);
Determines whether a System.String
contains another System.String
.
Overloads
- Contains(string, bool)
- Contains(string, StringComparison)
- OrdinalContains(string)
- OrdinalContains(string, bool)
Determines whether a System.String
contains another System.String
using StringComparison.CurrentCulture
with option to ignore case.
public static string Contains(this string text, string search, bool ignoreCase);
System.NullReferenceException
: if current string is nullSystem.NullReferenceException
: if search string is null
Determines whether a System.String
contains another System.String
using a specified StringComparison
.
public static string Contains(this string text, string search, StringComparison stringComparison);
System.NullReferenceException
: if current string is nullSystem.NullReferenceException
: if search string is null
Determines whether a System.String
contains another System.String
using StringComparison.Ordinal
.
public static string OrdinalContains(this string text, string search);
System.NullReferenceException
: if current string is nullSystem.NullReferenceException
: if search string is null
Determines whether a System.String
contains another System.String
using StringComparison.Ordinal
with option to ignore case.
public static string OrdinalContains(this string text, string search, bool ignoreCase);
System.NullReferenceException
: if current string is nullSystem.NullReferenceException
: if search string is null