REPLACE/REPLACEB Function

The REPLACE/REPLACEB function is one of the text and data functions. Is used to replace a set of characters, based on the number of characters and the start position you specify, with a new set of characters. The REPLACE function is intended for languages that use the single-byte character set (SBCS), while REPLACEB - for languages that use the double-byte character set (DBCS) like Japanese, Chinese, Korean etc.

Syntax

REPLACE(old_text, start_num, num_chars, new_text)

The REPLACE function has the following arguments:

Argument Description
old_text The original text to be replaced.
start_num The beginning of the set to be replaced.
num_chars The number of characters to be replaced.
new_text The new text.

REPLACEB(old_text, start_num, num_bytes, new_text)

The REPLACEB function has the following arguments:

Argument Description
old_text The original text to be replaced.
start_num The beginning of the set to be replaced.
num_bytes The number of characters to be replaced, based on bytes.
new_text The new text.

Notes

The REPLACE function is case-sensitive.

How to apply the REPLACE/REPLACEB function.

Examples

The figure below displays the result returned by the REPLACE function.

REPLACE Function