Click or drag to resize

ExtensionsReplace Method (String, Char, Char, Int32)

Replaces a series of chars oldChars with a single char newChar.

Namespace:  Cauldron
Assembly:  Cauldron (in Cauldron.dll) Version: 3.2.0.1 (3.2.0.1)
Syntax
C#
public static string Replace(
	this string value,
	char[] oldChars,
	char newChar,
	int startingIndex = 0
)

Parameters

value
Type: SystemString
The string with the chars to replace
oldChars
Type: SystemChar
The old chars to be replaced by newChar
newChar
Type: SystemChar
The new char that replaces the old chars
startingIndex (Optional)
Type: SystemInt32
The index where to start replacing chars

Return Value

Type: String
A copy of the original string with the chars defined by oldChars replaced by newChar.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type String. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Exceptions
ExceptionCondition
ArgumentNullExceptionvalue is null
ArgumentOutOfRangeExceptionstartingIndex is higher than value length
See Also