Description:
Replace a specified substring of a source string.
Syntax:
replace (src,a,b)
Note:
The function replaces the substring a of string src with another string b.
Parameter:
src |
Source string |
a |
The substring of a source string |
b |
The string with which the specified string will be replaced |
Option:
@q |
A quoted specified string won’t be replaced |
@1 |
Enble to replace the first-found specified substring only |
@c |
Case-insensitive |
Return value:
A string after the replacement
Example:
replace("123321","2","two") |
1two33two1 |
replace("abc'abc'def","a","China") |
Chinabc'Chinabc'def |
replace@q("abc'abc'def","a","China") |
Chinabc'abc'def; the “a” enclosed by the single quotes are not replaced |
replace@1("abcabcdef","a","China") |
Chinabcabcdef; only the first “a” is replaced |
replace@c("abcabcdef","A","China") |
ChinabcChinabcdef; case-insensitive |