Click or drag to resize

ConversionsReplace Method

Returns a new string in which all occurrences of a specified string in the current instance are replaced with another specified string, using the provided comparison type.

Namespace:  callback.ShellBoost.Core.Utilities
Assembly:  callback.CBFSShell (in callback.CBFSShell.dll) Version: 22.0.0.0
Syntax
C#
public static string Replace(
	this string str,
	string oldValue,
	string newValue,
	StringComparison comparisonType
)

Parameters

str
Type: SystemString
The current instance string.
oldValue
Type: SystemString
The string to be replaced.
newValue
Type: SystemString
The string to replace all occurrences of oldValue.
comparisonType
Type: SystemStringComparison
The comparison type.

Return Value

Type: String
A string that is equivalent to the current string except that all instances of oldValue are replaced with newValue. If oldValue is not found in the current instance, the method returns the current instance unchanged.

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
ArgumentNullExceptionoldValue is null.
ArgumentExceptionoldValue is empty.
See Also