User Tools

Site Tools


Replace(text, old_text, new_text)

Category: Text function


This function replaces all instances of old_text with new_text within text.


textTextAny text value or value that can be implicitly converted to text.
old_textTextThe text to be found within text and replaced by new_text, if found.
new_textTextThe text that replaces old_text if found within text.

Return value type: Text


This function is case sensitive.

Entering '' (two single quotes; an empty string) as the new_text value has the same effect as using the RemoveText function.

Number values entered for text, old_text, and new_text are implicitly converted to text.


replace('Food & Beverage', '&', 'and') //Returns 'Food and Beverage'
replace('New York', 'york', 'Orleans') //Returns 'New York' ('york' isn't found due to the case of 'y'.)
replace('New Mexico', ' ', '_') //Returns 'New_Mexico' (Replaces spaces with underscores.)
replace(123456789, 456, 654) //Returns '123654789' (Number implicitly converted; return value is text.)
replace(190091, "00", 5) //Returns '19591' (Enter multiple zeroes as text; return value is text.)

See also

syntax/functions/replace.txt · Last modified: 2021/09/08 14:19 by craigt

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki