Show / Hide Table of Contents

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 Source

StringReplacePair(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 oldValue.

Properties

| Improve this Doc View Source

NewValue

Gets the String value to replace all occurrences of OldValue.

Declaration
public readonly string NewValue { get; }
Property Value
Type Description
String

The String value to replace all occurrences of OldValue.

| Improve this Doc View Source

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 Source

Equals(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

true if the current object is equal to the other parameter; otherwise, false.

| Improve this Doc View Source

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

true if the specified Object is equal to this instance; otherwise, false.

Overrides
ValueType.Equals(Object)
| Improve this Doc View Source

GetHashCode()

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
ValueType.GetHashCode()
| Improve this Doc View Source

RemoveAll(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 value except for the removed characters.

| Improve this Doc View Source

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 value except for the removed characters and/or words.

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.

| Improve this Doc View Source

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 value except for the removed characters and/or words.

| Improve this Doc View Source

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 source except for the removed characters and/or words.

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.

| Improve this Doc View Source

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 source except for the removed characters and/or words.

| Improve this Doc View Source

ReplaceAll(String, IEnumerable<StringReplacePair>, StringComparison)

Replaces all occurrences of the OldValue with NewValue of the replacePairs sequence in value.

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 value but with all instances of OldValue replaced with NewValue.

Exceptions
Type Condition
ArgumentNullException

value is null -or- replacePairs is null.

| Improve this Doc View Source

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 oldValue.

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 value but with all instances of oldValue replaced with newValue.

Exceptions
Type Condition
ArgumentNullException

value is null -or- oldValue is null.

| Improve this Doc View Source

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
ValueType.ToString()
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 Source

Equality(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

true if the values of replacePair1 and replacePair2 are equal; otherwise, false.

| Improve this Doc View Source

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

true if the values of replacePair1 and replacePair2 are not equal; otherwise, false.

  • Improve this Doc
  • View Source
In This Article
Back to top Copyright 2008-2022 Geekle. All rights reserved. Code with passion and love; deploy with confidence. 👨‍💻️🔥❤️🚀😎
Generated by DocFX