Class StringExtensions
- Namespace
- Heleonix.Extensions
- Assembly
- Heleonix.Extensions.dll
Provides functionality to work with strings.
public static class StringExtensions
- Inheritance
-
StringExtensions
- Inherited Members
Methods
FormatWith(string, IFormatProvider, params object[])
Formats the specified format string with the specified arguments using a specified format provider.
public static string FormatWith(this string format, IFormatProvider formatProvider, params object[] args)
Parameters
format
stringThe format.
formatProvider
IFormatProviderThe format provider.
args
object[]The arguments.
Returns
- string
Formatted string or empty string if
format
is not specified.
Exceptions
- ArgumentNullException
The
formatProvider
isnull
.- FormatException
format
is invalid the index of a format item is less than zero, or greater than or equal to the length of theargs
array.
FormatWith(string, params object[])
Formats the specified format string with the specified arguments.
public static string FormatWith(this string format, params object[] args)
Parameters
Returns
- string
Formatted string or empty string if
format
is not specified.
Examples
var str = "{0} plus {1} equals {2}".FormatWith(1, 2, 3);
// "1 plus 2 equals 3".
Exceptions
- FormatException
format
is invalid or the index of a format item is less than zero, or greater than or equal to the length of theargs
array.
IsNullOrEmptyOrWhiteSpace(string)
Determines whether this instance is null
or empty or whitespace.
public static bool IsNullOrEmptyOrWhiteSpace(this string instance)
Parameters
instance
stringThe instance.
Returns
- bool
true
if this instance isnull
or empty or whitespace, otherwise,false
.