SpreadJS Documentation
REPLACEB
SpreadJS Documentation > Formula Reference > Formula Functions > REPLACEB

This function replaces part of a text string with a different text string (based on specified number of bytes).

Syntax

REPLACEB(old_text,start_char,num_bytes,new_text)

Arguments

This function has the following arguments:

Argument Description
old_text Refers to the original text in which you want to replace characters.
start_char Refers to the starting position in the original text to begin the replacement.
num_bytes Refers to the number of bytes in the original text that you want to replace with characters from the new text. If this function is not an integer, the number is truncated.
new_text Refers to the new text that replaces characters in the original text.

Remarks

The REPLACEB function counts 2 bytes per character, but this happens only when a DBCS language is set as the default language.

Data Types

Accepts string data for the old_text argument, numeric data for the start_char argument, numeric data for the num_bytes argument, and string data for the new_text argument. Returns string data.

Examples

REPLACEB("lovely",1,3,"lo") gives the result loely.

REPLACEB("rosy",1,3,"!") gives the result !y.

See Also