Replace

This function can be used to replace a given string with another string as part of a single string value or within an array or object.

Syntax

string replace(string $input, string $oldString, string $newString)

Replaces $oldString with $newString in $input.

Parameters

$input: The string to split.
$oldString: The string to replace.
$newString: The string to replace the identified $oldString.

Example

{
	"String": "Lorem Ipsum Dolor"
}
{
	"NewString": replace(String, 'Lorem Ipsum', 'Sit Amet')
}
{
	"NewString": "Sit Amet Dolor"
}

In this example the string value “String” has the string “Lorem Ipsum” replaced with the string “Sit Amet”.