Class StringExtensions
General extension methods for strings (System.String).
Inheritance
System.Object
StringExtensions
Assembly: Kros.Utils.dll
Syntax
public static class StringExtensions
Methods
Declaration
public static string Format(this string format, IFormatProvider provider, object arg0)
Parameters
| Type |
Name |
Description |
| System.String |
format |
|
| System.IFormatProvider |
provider |
|
| System.Object |
arg0 |
|
Returns
| Type |
Description |
| System.String |
|
Declaration
public static string Format(this string format, IFormatProvider provider, object arg0, object arg1)
Parameters
| Type |
Name |
Description |
| System.String |
format |
|
| System.IFormatProvider |
provider |
|
| System.Object |
arg0 |
|
| System.Object |
arg1 |
|
Returns
| Type |
Description |
| System.String |
|
Declaration
public static string Format(this string format, IFormatProvider provider, object arg0, object arg1, object arg2)
Parameters
| Type |
Name |
Description |
| System.String |
format |
|
| System.IFormatProvider |
provider |
|
| System.Object |
arg0 |
|
| System.Object |
arg1 |
|
| System.Object |
arg2 |
|
Returns
| Type |
Description |
| System.String |
|
Declaration
public static string Format(this string format, IFormatProvider provider, params object[] args)
Parameters
| Type |
Name |
Description |
| System.String |
format |
|
| System.IFormatProvider |
provider |
|
| System.Object[] |
args |
|
Returns
| Type |
Description |
| System.String |
|
Declaration
public static string Format(this string format, object arg0)
Parameters
| Type |
Name |
Description |
| System.String |
format |
|
| System.Object |
arg0 |
|
Returns
| Type |
Description |
| System.String |
|
Declaration
public static string Format(this string format, object arg0, object arg1)
Parameters
| Type |
Name |
Description |
| System.String |
format |
|
| System.Object |
arg0 |
|
| System.Object |
arg1 |
|
Returns
| Type |
Description |
| System.String |
|
Declaration
public static string Format(this string format, object arg0, object arg1, object arg2)
Parameters
| Type |
Name |
Description |
| System.String |
format |
|
| System.Object |
arg0 |
|
| System.Object |
arg1 |
|
| System.Object |
arg2 |
|
Returns
| Type |
Description |
| System.String |
|
Declaration
public static string Format(this string format, params object[] args)
Parameters
| Type |
Name |
Description |
| System.String |
format |
|
| System.Object[] |
args |
|
Returns
| Type |
Description |
| System.String |
|
IsNullOrEmpty(String)
Checks, if string value is null, or empty string (string.Empty).
Declaration
public static bool IsNullOrEmpty(this string value)
Parameters
| Type |
Name |
Description |
| System.String |
value |
Checked stirng.
|
Returns
| Type |
Description |
| System.Boolean |
true, if value is null or string.Empty,
false otherwise.
|
IsNullOrWhiteSpace(String)
Checks, if string value is null, empty string (string.Empty),
or string containig only whitespace characters.
Declaration
public static bool IsNullOrWhiteSpace(this string value)
Parameters
| Type |
Name |
Description |
| System.String |
value |
Checked string.
|
Returns
| Type |
Description |
| System.Boolean |
true, if value is null, empty string, or string
containing only white characters, false otherwise.
|
Left(String, Int32)
Returns first length of characters form input string value.
Declaration
public static string Left(this string value, int length)
Parameters
| Type |
Name |
Description |
| System.String |
value |
Input string.
|
| System.Int32 |
length |
Number of characters at the begining of value which are returned.
|
Returns
| Type |
Description |
| System.String |
Begining of the input string value of length length.
If value is null, empty string is returned. If value of length
is greater than length of value, the value itself is returned.
|
Exceptions
| Type |
Condition |
| System.ArgumentException |
Value of length is less than 0.
|
RemoveDiacritics(String)
Returns the same string without diacritic marks (for example čšá becomes csa).
Declaration
public static string RemoveDiacritics(this string value)
Parameters
| Type |
Name |
Description |
| System.String |
value |
|
Returns
| Type |
Description |
| System.String |
|
RemoveNewLines(String)
Removes new line characters from string. Removed characters are line feed (\n) and
carriage return (\r).
Declaration
public static string RemoveNewLines(this string value)
Parameters
| Type |
Name |
Description |
| System.String |
value |
Input string.
|
Returns
| Type |
Description |
| System.String |
String without new line characters, or null if value
is null.
|
Right(String, Int32)
Returns last length of characters form input string value.
Declaration
public static string Right(this string value, int length)
Parameters
| Type |
Name |
Description |
| System.String |
value |
Input string.
|
| System.Int32 |
length |
Number of characters at the end of value which are returned.
|
Returns
| Type |
Description |
| System.String |
End of the input string value of length length.
If value is null, empty string is returned. If value of length
is greater than length of value, the value itself is returned.
|
Exceptions
| Type |
Condition |
| System.ArgumentException |
Value of length is less than 0.
|