
//将字符串s中的c1替换为c2
if isnull(s) or s = "" then return ''
if c1=c2 then return s
if isnull(c2) then return s
long l
do while True
l=pos(s,c1)
if l=0 then return s
s=replace(s,l,len(c1),c2)
loop
这段代码展示了如何在PowerBuilder中使用字符串函数,将字符串s中出现的所有字符c1替换为c2。如果s为空或者c1等于c2,函数将返回原始字符串。如果c2为空,则不进行替换。

//将字符串s中的c1替换为c2
if isnull(s) or s = "" then return ''
if c1=c2 then return s
if isnull(c2) then return s
long l
do while True
l=pos(s,c1)
if l=0 then return s
s=replace(s,l,len(c1),c2)
loop
598

被折叠的 条评论
为什么被折叠?