replace ()

阅读(624) 标签: 修改, 源字符串, 子串,

描述:

更改源字符串的子串

语法:

replace(src,a,b)

备注:

将字符串src的子字符串a变为字符串b

参数:

src

源字符串

a

源字符串的子字符串

b

目标子字符串

选项:

@q

引号里的字符不需要进行替换

@1

只替换第一个

@c

大小写不敏感

返回值:

替换后的字符串

示例:

replace("123321","2","two")

1two33two1

replace("abc'abc'def","a","China")

Chinabc'Chinabc'def

replace@q("abc'abc'def","a","China")

Chinabc'abc'def,引号里的字符不需要进行替换

replace@1("abcabcdef","a","China")

Chinabcabcdef,只替换第一个

replace@c("abcabcdef","A","China")

ChinabcChinabcdef,大小写不敏感