StringReplace
Returns a new string in which all occurrences of a specified string in the current instance are replaced with another specified string. If oldValue is not found in the current instance, the method returns the current instance unchanged.
StringReplace("baseString","oldValue","newValue");Function arguments
Dział zatytułowany „Function arguments”- baseString – (String) The string to be altered (changed)
- oldValue – (String) String to be found within baseString
- newValue – (String) String to replace all occurences of oldValue
Return value
Dział zatytułowany „Return value”This function returns String. A string that is equivalent to the current string except that all instances of oldValue are replaced with newValue.
Examples
Dział zatytułowany „Examples”Example 1: ’replaced’ variable value will be „some string instance and other instance”
replaced = StringReplace("some string value and other value", "value","instance");Example 2: ’replaced’ variable value will be „abcqazqwe”
replaced = StringReplace("abcxyzqwe", "xyz","qaz");Example 3: ’replaced’ variable value will be „abcxyzqwe”
replaced = StringReplace("abcxyzqwe", "not","found");