Struct StringReplacePair
Defines a oldValue/newValue pair that can be set or retrieved for string replace operations.
Namespace: Cuemon
Assembly: Cuemon.Core.dll
Syntax
public readonly struct StringReplacePair
Constructors
| Improve this Doc View SourceStringReplacePair(String, String)
Initializes a new instance of the StringReplacePair struct.
Declaration
public StringReplacePair(string oldValue, string newValue)
Parameters
Type | Name | Description |
---|---|---|
String | oldValue | The String value to be replaced. |
String | newValue | The String value to replace all occurrences of |
Properties
| Improve this Doc View SourceNewValue
Declaration
public readonly string NewValue { get; }
Property Value
Type | Description |
---|---|
String |
OldValue
Gets the String value to be replaced.
Declaration
public readonly string OldValue { get; }
Property Value
Type | Description |
---|---|
String | The String value to be replaced. |
Methods
| Improve this Doc View SourceEquals(StringReplacePair)
Indicates whether the current object is equal to another object of the same type.
Declaration
public readonly bool Equals(StringReplacePair other)
Parameters
Type | Name | Description |
---|---|---|
StringReplacePair | other | An object to compare with this object. |
Returns
Type | Description |
---|---|
Boolean |
|
Equals(Object)
Determines whether the specified Object is equal to this instance.
Declaration
public override readonly bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
Object | obj | The Object to compare with this instance. |
Returns
Type | Description |
---|---|
Boolean |
|
Overrides
| Improve this Doc View SourceGetHashCode()
Returns a hash code for this instance.
Declaration
public override readonly int GetHashCode()
Returns
Type | Description |
---|---|
Int32 | A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. |
Overrides
| Improve this Doc View SourceRemoveAll(String, Char[])
Returns a new string in which all the specified fragments
has been deleted from the specified value
.
Declaration
public static string RemoveAll(string value, params char[] fragments)
Parameters
Type | Name | Description |
---|---|---|
String | value | The String value to perform the sweep on. |
Char[] | fragments | The fragments containing the characters and/or words to delete. |
Returns
Type | Description |
---|---|
String | A new string that is equivalent to |
RemoveAll(String, String[])
Returns a new string in which all the specified fragments
has been removed from the specified value
.
Declaration
public static string RemoveAll(string value, params string[] fragments)
Parameters
Type | Name | Description |
---|---|---|
String | value | The String value to perform the sweep on. |
String[] | fragments | The fragments containing the characters and/or words to delete. |
Returns
Type | Description |
---|---|
String | A new string that is equivalent to |
Remarks
This method performs an ordinal (case-sensitive and culture-insensitive) comparison. The search begins at the first character position of this string and continues through the last character position.
RemoveAll(String, StringComparison, String[])
Returns a new string in which all the specified fragments
has been deleted from the specified value
.
Declaration
public static string RemoveAll(string value, StringComparison comparison, params string[] fragments)
Parameters
Type | Name | Description |
---|---|---|
String | value | The String value to perform the sweep on. |
StringComparison | comparison | One of the enumeration values that specifies the rules to use in the comparison. |
String[] | fragments | The fragments containing the characters and/or words to delete. |
Returns
Type | Description |
---|---|
String | A new string that is equivalent to |
RemoveAll(String[], String[])
Returns a new string array in which all the specified fragments
has been deleted from the specified source
array.
Declaration
public static string[] RemoveAll(string[] source, params string[] fragments)
Parameters
Type | Name | Description |
---|---|---|
String[] | source | The string[] value to perform the sweep on. |
String[] | fragments | The fragments containing the characters and/or words to delete. |
Returns
Type | Description |
---|---|
String[] | A new string array that is equivalent to |
Remarks
This method performs an ordinal (case-sensitive and culture-insensitive) comparison. The search begins at the first character position of this string and continues through the last character position.
RemoveAll(String[], StringComparison, String[])
Returns a new string array in which all the specified fragments
has been deleted from the specified source
array.
Declaration
public static string[] RemoveAll(string[] source, StringComparison comparison, params string[] fragments)
Parameters
Type | Name | Description |
---|---|---|
String[] | source | The string[] value to perform the sweep on. |
StringComparison | comparison | One of the enumeration values that specifies the rules to use in the comparison. |
String[] | fragments | The fragments containing the characters and/or words to delete. |
Returns
Type | Description |
---|---|
String[] | A new string array that is equivalent to |
ReplaceAll(String, IEnumerable<StringReplacePair>, StringComparison)
Declaration
public static string ReplaceAll(string value, IEnumerable<StringReplacePair> replacePairs, StringComparison comparison = StringComparison.OrdinalIgnoreCase)
Parameters
Type | Name | Description |
---|---|---|
String | value | The String value to perform the replacement on. |
IEnumerable<StringReplacePair> | replacePairs | A sequence of StringReplacePair values. |
StringComparison | comparison | One of the enumeration values that specifies the rules to use in the comparison. Default is OrdinalIgnoreCase. |
Returns
Type | Description |
---|---|
String | A String equivalent to |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
ReplaceAll(String, String, String, StringComparison)
Replaces all occurrences of oldValue
in value
, with newValue
.
Declaration
public static string ReplaceAll(string value, string oldValue, string newValue, StringComparison comparison = StringComparison.OrdinalIgnoreCase)
Parameters
Type | Name | Description |
---|---|---|
String | value | The String value to perform the replacement on. |
String | oldValue | The String value to be replaced. |
String | newValue | The String value to replace all occurrences of |
StringComparison | comparison | One of the enumeration values that specifies the rules to use in the comparison. Default is OrdinalIgnoreCase. |
Returns
Type | Description |
---|---|
String | A String equivalent to |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
ToString()
Returns a string representation of the StringReplacePair, using the string representations of the oldValue and newValue.
Declaration
public override readonly string ToString()
Returns
Type | Description |
---|---|
String | A string representation of the StringReplacePair, which includes the string representations of the oldValue and newValue. |
Overrides
Remarks
The string representation consists of the string representations of the oldValue and newValue, separated by a comma and a space, and enclosed in square brackets. For example, the ToString method for a StringReplacePair structure with the string OldValue "Test1" and the string NewValue "Test2" returns the string "[Test1, Test2]".
Operators
| Improve this Doc View SourceEquality(StringReplacePair, StringReplacePair)
Indicates whether two StringReplacePair instances are equal.
Declaration
public static bool operator ==(StringReplacePair replacePair1, StringReplacePair replacePair2)
Parameters
Type | Name | Description |
---|---|---|
StringReplacePair | replacePair1 | The first date interval to compare. |
StringReplacePair | replacePair2 | The second date interval to compare. |
Returns
Type | Description |
---|---|
Boolean |
|
Inequality(StringReplacePair, StringReplacePair)
Indicates whether two DateSpan instances are not equal.
Declaration
public static bool operator !=(StringReplacePair replacePair1, StringReplacePair replacePair2)
Parameters
Type | Name | Description |
---|---|---|
StringReplacePair | replacePair1 | The first date interval to compare. |
StringReplacePair | replacePair2 | The second date interval to compare. |
Returns
Type | Description |
---|---|
Boolean |
|