Print

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.

Syntax

StringReplace("baseString","oldValue","newValue");

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

This function returns String.
A string that is equivalent to the current string except that all instances of oldValue are replaced with newValue.

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");
Czy artykuł był pomocny?
0 na 5 gwiazdek
5 Stars 0%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
5
How can we improve this article?
How Can We Improve This Article?