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

arg1stringdefault: null

The text or the reference to a cell containing text in which the characters will be substituted.

arg2stringdefault: 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.

arg3stringdefault: null

The text to replace the original text with.

arg4stringdefault: 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"));

Get Help

  • If you have any questions about ONLYOFFICE Docs, try the FAQ section first.
  • You can request a feature or report a bug by posting an issue on GitHub.
  • You can also ask our developers on ONLYOFFICE forum (registration required).