Table of Contents

Method Replace

Namespace
Alternet.Common
Assembly
Alternet.Common.v9.dll

Replace(string, string, string, StringComparison, bool)

Returns a new string in which all occurrences of a specified string in the source string are replaced with another specified string.

public static string Replace(this string source, string oldString, string newString, StringComparison comparison, bool firstOccurrenceOnly = false)

Parameters

source string

Source string to process.

oldString string

The string to be replaced.

newString string

The string to replace all occurrences of oldString.

comparison StringComparison

One of the enumeration values that specifies the rules for the replacement.

firstOccurrenceOnly bool

Replace only first occurrence.

Returns

string

A string that is equivalent to the source string except that all instances of oldString are replaced with newString.