1234567891011121314151617181920212223242526272829303132 |
- $PBExportHeader$f_replacestr.srf
- global type f_replacestr from function_object
- end type
- forward prototypes
- global function string f_replacestr (string arg_sorstr, string arg_finreplstr, string arg_replobjstr)
- end prototypes
- global function string f_replacestr (string arg_sorstr, string arg_finreplstr, string arg_replobjstr);//f_replacestr(arg_sorstr,arg_finreplstr,arg_replobjstr)
- string obj_str
- obj_str=arg_sorstr
- long lssit,lssitn,cnt=0
- lssit=pos(arg_sorstr,arg_finreplstr)
- lssitn=lssit
- do while lssit>0 and cnt<1000
-
- obj_str=Replace(obj_str, lssit, len(arg_finreplstr), arg_replobjstr)
- if len(arg_replobjstr)>len(arg_finreplstr) then
- lssitn=lssitn+len(arg_replobjstr)
- else
- lssitn=lssitn+len(arg_finreplstr)
- end if
-
- lssit=pos(obj_str,arg_finreplstr,lssitn )
-
- cnt++
- loop
- return obj_str
- end function
|