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
initialPathstringThe first path to combine. This can be absolute or relative.
pathsstring[]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
sourcestringString to search for matches
valuestringThe string to seek
comparisonStringComparisonComparison rule
Returns
- bool
true if the value parameter occurs within this string, or if value is the empty string (""); otherwise, false.
IsNotNullOrEmpty(string?)
A nicer way of calling the inverse of IsNullOrEmpty(string)
public static bool IsNotNullOrEmpty(this string? value)
Parameters
valuestringThe 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
valuestringThe 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
inputstringThe 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
inputstringThe input.
oldValuestringThe old value.
newValuestringThe new value.
optionsRegexOptionsThe options.
Returns
- string
System.String.
UrlEscape(string?)
Returns a URL encoded string of the provided input string value.
public static string? UrlEscape(this string? value)
Parameters
valuestring
Returns
- string
URL encoded value