字符串替换

$PBExportHeader$uf_replace.srf
global type uf_replace from function_object
end type
forward prototypes
global function string uf_replace (string astr_str, string astr_old, string astr_new)
end prototypes
global function string uf_replace (string astr_str, string astr_old, string astr_new);string old_str, new_str, mystring
long start_pos=1
mystring = astr_str
old_str = astr_old
new_str = astr_new
start_pos = Pos(mystring, old_str, start_pos)
DO WHILE start_pos > 0
    mystring = Replace(mystring, start_pos, Len(old_str), new_str)
    start_pos = Pos(mystring, old_str,start_pos+Len(new_str))
LOOP
return mystring
end function

你可能感兴趣的:(字符串)