AdvantageCMS.Core.Common.BaseClasses Namespace
Build With Advantage

StringExtensions..::..ReplaceFirst Method

A string extension method that replace first occurence.

Namespace:  AdvantageCMS.Core.Common
Assembly:  AdvantageCMS.Core (in AdvantageCMS.Core.dll)

Syntax


public static string ReplaceFirst(
	this string this,
	string oldValue,
	string newValue
)

Parameters

this
Type: String
The @this to act on.
oldValue
Type: String
The old value.
newValue
Type: String
The new value.

Return Value

The string with the first occurence of old value replace by new value.

Examples


C#
string result = "foo bar foo".ReplaceFirst("foo", "baz"); // returns "baz bar foo"