• Home
  • REPLACE function

REPLACE 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:

ArgumentDescription
old_textThe original text to be replaced.
start_numThe beginning of the set to be replaced.
num_charsThe number of characters to be replaced.
new_textThe new text.

REPLACEB(old_text, start_num, num_bytes, new_text)

The REPLACEB function has the following arguments:

ArgumentDescription
old_textThe original text to be replaced.
start_numThe beginning of the set to be replaced.
num_bytesThe number of characters to be replaced, based on bytes.
new_textThe 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

Article with the tag:
Browse all tags