REPLACE

REPLACE(arg1, arg2, arg3, arg4) → { string }

Replaces part of a text string with a different text string.

Parameters:

Name Type Description
arg1 string

The text where some characters will be replaced.

arg2 number

The position of the character in the original text that will be replaced with the new text.

arg3 number

The number of characters in the original text that will be replaced.

arg4 string

The text that will replace characters in the original text.

Returns:

Type
string

Example

Copy code
builder.CreateFile("xlsx");
var oWorksheet = Api.GetActiveSheet();
var oFunction = Api.GetWorksheetFunction();
oWorksheet.GetRange("A1").SetValue(oFunction.REPLACE("Online Office", 8, 6, "portal"));
builder.SaveFile("xlsx", "REPLACE.xlsx");
builder.CloseFile();

Resulting document