Class StringHelper
Various string extension methods
Assembly: TOMWrapper.dll
Syntax
public static class StringHelper
Methods
EqualsI(string, string)
Invariant Culture Ignore Case comparison between two strings.
Declaration
public static bool EqualsI(this string str, string other)
Parameters
Returns
EqualsTI(string, string)
Invariant Culture Ignore Case and trailing/leading whitespace comparison of two strings.
Declaration
public static bool EqualsTI(this string current, string value)
Parameters
Returns
FirstNLines(string, int, bool)
Returns the first N lines of a string, optionally adding an ellipsis if there are more lines.
Declaration
public static string FirstNLines(this string value, int n, bool addEllipsis)
Parameters
Returns
Similar to string.Format but using invariant culture
Declaration
public static string FormatInvariant(this string format, params object[] args)
Parameters
Returns
IsNumeric(string, bool)
Determines if a string represents a numeric value
Declaration
public static bool IsNumeric(this string value, bool allowDecimals = false)
Parameters
Type |
Name |
Description |
string |
value |
|
bool |
allowDecimals |
|
Returns
Left(string, int, bool)
Shortens a string from the left to the specified number of characters, optionally adding an ellipsis if the string contains more characters than that
Declaration
public static string Left(this string value, int chars, bool addEllipsis = false)
Parameters
Returns
Replace(string, char[], char)
Replace any occurrence of characters with a specific chracter
Declaration
public static string Replace(this string value, char[] find, char replace)
Parameters
Returns
Replace(string, char[], char[])
Replaces any occurrence of various chracters with a different character
Declaration
public static string Replace(this string value, char[] find, char[] replace)
Parameters
Returns
Exceptions
Replace(string, char[], string[])
Replaces any occurrence of various chracters with a different string
Declaration
public static string Replace(this string value, char[] find, string[] replace)
Parameters
Returns
Exceptions
Replace(string, string, string, StringComparison)
Returns a new string in which all occurrences of a specified string in the current instance are replaced with another specified string.
Declaration
public static string Replace(this string str, string oldValue, string newValue, StringComparison comparison)
Parameters
Type |
Name |
Description |
string |
str |
Current instance
|
string |
oldValue |
The string to be replaced
|
string |
newValue |
The string to replace all occurrences of oldValue
|
StringComparison |
comparison |
One of the enumeration values that specifies the rules for the search
|
Returns
Right(string, int)
Shortens a string from the right to the specified number of characters
Declaration
public static string Right(this string value, int chars)
Parameters
Returns
SplitCamelCase(string)
Splits a string typed as CamelCase (aka. PascalCase) into separate words.
Declaration
public static string SplitCamelCase(this string str)
Parameters
Type |
Name |
Description |
string |
str |
|
Returns