25.165. REPLACE(base_string,search_string,replace_string [,number_of_replaces] [,position])

[<<<] [>>>]

This function replaces one or more occurrences of a sub-string in a string. REPLACE(a,b,c) searches the string a seeking for occurrences of sub-string b and replaces each of them with the string c.

The fourth and fifth arguments are optional. The fourth argument specifies the number of replaces to be performed. If this is missing or is undef then all occurrences of string b will be replaced. The fifth argument may specify the start position of the operation. For example the function call

REPLACE("alabama mama", "a","x",3,5)

will replace only three occurrences of string "a" starting at position 5. The result is "alabxmx mxma".


[<<<] [>>>]