Table of Contents

ReplaceAll Method

Definition

Namespace
Cuemon
Assemblies
Cuemon.Core.dll
Source
src/Cuemon.Core/StringReplacePair.cs

ReplaceAll(string, string, string, StringComparison)

Replaces all occurrences of oldValue in value, with newValue.

public static string ReplaceAll(string value, string oldValue, string newValue, StringComparison comparison = StringComparison.OrdinalIgnoreCase)

Parameters

value string

The string value to perform the replacement on.

oldValue string

The string value to be replaced.

newValue string

The string value to replace all occurrences of oldValue.

comparison StringComparison

One of the enumeration values that specifies the rules to use in the comparison. Default is OrdinalIgnoreCase.

Returns

string

A string equivalent to value but with all instances of oldValue replaced with newValue.

Exceptions

ArgumentNullException

value is null -or- oldValue is null.

ReplaceAll(string, IEnumerable<StringReplacePair>, StringComparison)

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

public static string ReplaceAll(string value, IEnumerable<StringReplacePair> replacePairs, StringComparison comparison = StringComparison.OrdinalIgnoreCase)

Parameters

value string

The string value to perform the replacement on.

replacePairs IEnumerable<StringReplacePair>

A sequence of StringReplacePair values.

comparison StringComparison

One of the enumeration values that specifies the rules to use in the comparison. Default is OrdinalIgnoreCase.

Returns

string

A string equivalent to value but with all instances of OldValue replaced with NewValue.

Exceptions

ArgumentNullException

value is null -or- replacePairs is null.