f_replace.srf 565 B

1234567891011121314151617181920
  1. $PBExportHeader$f_replace.srf
  2. $PBExportComments$字符串替换处理--函数
  3. global type f_replace from function_object
  4. end type
  5. forward prototypes
  6. global function string f_replace (string ls_source, string ls_old, string ls_new)
  7. end prototypes
  8. global function string f_replace (string ls_source, string ls_old, string ls_new);string ls_tran
  9. int li_pos
  10. do while 1=1
  11. li_pos=pos(ls_source,ls_old)
  12. if li_pos=0 then exit
  13. ls_tran=ls_tran+left(ls_source,li_pos - 1)+ls_new
  14. ls_source=mid(ls_source,li_pos+len(ls_old))
  15. loop
  16. return ls_tran+ls_source
  17. end function