Class StringExtensions
- Namespace
- Dynamicweb.Core
- Assembly
- Dynamicweb.Core.dll
Extensions for string
public static class StringExtensions
- Inheritance
-
StringExtensions
- Inherited Members
Methods
CombinePaths(string, params string[]?)
Combines any number of file system paths properly.
public static string CombinePaths(this string initialPath, params string[]? paths)
Parameters
initialPath
stringThe first path to combine. This can be absolute or relative.
paths
string[]The paths to combine with initialPath. These are relative to initialPath.
Returns
- string
The combined path.
Contains(string, string, StringComparison)
Returns a value indicating whether a specified substring occurs within this string.
public static bool Contains(this string source, string value, StringComparison comparison)
Parameters
source
stringString to search for matches
value
stringThe string to seek
comparison
StringComparisonComparison rule
Returns
- bool
true if the value parameter occurs within this string, or if value is the empty string (""); otherwise, false.
FormatWith(string, params object[])
A nicer way of calling Format(string, params object[])
public static string FormatWith(this string format, params object[] args)
Parameters
format
stringA composite format string.
args
object[]An object array that contains zero or more objects to format.
Returns
- string
A copy of format in which the format items have been replaced by the string representation of the corresponding objects in args.
IsNotNullOrEmpty(string?)
A nicer way of calling the inverse of IsNullOrEmpty(string)
public static bool IsNotNullOrEmpty(this string? value)
Parameters
value
stringThe string to test.
Returns
- bool
true if the value parameter is not null or an empty string (""); otherwise, false.
IsNullOrEmpty(string?)
A nicer way of calling IsNullOrEmpty(string)
public static bool IsNullOrEmpty(this string? value)
Parameters
value
stringThe string to test.
Returns
- bool
true if the value parameter is null or an empty string (""); otherwise, false.
IsNumeric(string)
Returns a value indicating if the string is numeric
public static bool IsNumeric(this string input)
Parameters
input
stringThe string to test if is numeric
Returns
- bool
True if the string is numeric, otherwise false
Replace(string, string, string, RegexOptions)
Replaces the specified old value with the new value in the input.
public static string Replace(this string input, string oldValue, string newValue, RegexOptions options)
Parameters
input
stringThe input.
oldValue
stringThe old value.
newValue
stringThe new value.
options
RegexOptionsThe options.
Returns
- string
System.String.