This function replaces part of a text string with a different text string.
REPLACE(old_text,start_char,num_chars,new_text)
This function has these arguments:
Argument | Description |
---|---|
old_text | Original text in which you want to replace characters |
start_char | Starting position in the original text to begin the replacement |
num_chars | Number of characters in the original text that you want to replace with characters from the new text; if not an integer, the number is truncated |
new_text | New text that replaces characters in the original text |
Use this function to replace a specified number of characters in a specified location with other characters. Use the SUBSTITUTE function to replace specific text with other text.
Accepts string data for the old_text argument, numeric data for the start_char argument, numeric data for the num_chars argument, and string data for the new_text argument. Returns string data.
This example replaces three characters with one character, starting with the sixth character in the provided text:
REPLACE(""abcdefghijk"", 6, 3, ""%"") gives the result abcde%ijk