string class : Replace(string,string) method
Description
Gets a new instance of the string in which all occurrences of a specified string in the invoker string are replaced with specified string.
Syntax
stringInstance.Replace(string oldString, string newString)
Arguments
Class | Name | Description |
string | oldString | String to be replaced. |
string | newString | String to replace. |
Return value
Class | Description |
string | A new instance of the string in which all occurrences of a specified string in the invoker string are replaced with specified string. |
Sample code
//anyString is a instance of string type.
string replacedString = anyString.Replace("ww", "xx");
Notes
It's a wrapper of the System.String.Replace(String,String).