SUBSTITUTE
function SUBSTITUTE(
arg1: string = null,
arg2: string = null,
arg3: string = null,
arg4: string = null,
): string
Description
Replaces existing text with new text in a text string.
Parameters
- arg1
string
null The text or the reference to a cell containing text in which the characters will be substituted.
- arg2
string
null The existing text to replace. If the case of the original text does not match the case of text, the function will not replace the text.
- arg3
string
null The text to replace the original text with.
- arg4
string
null Specifies which occurrence of the original text to replace. If omitted, every instance of the original text will be replaced.
Returns
string
Try It
var oWorksheet = Api.GetActiveSheet();
var oFunction = Api.GetWorksheetFunction();
oWorksheet.GetRange("A1").SetValue(oFunction.SUBSTITUTE("Online Office is a cloud business service portal", "Office", "portal"));