f_replace_string_ws.srf 626 B

1234567891011121314151617181920212223242526
  1. $PBExportHeader$f_replace_string_ws.srf
  2. global type f_replace_string_ws from function_object
  3. end type
  4. forward prototypes
  5. global function string f_replace_string_ws (string arg_sorstr, string arg_objstr, string arg_replstr)
  6. end prototypes
  7. global function string f_replace_string_ws (string arg_sorstr, string arg_objstr, string arg_replstr);
  8. string ls_str,obj_str
  9. obj_str=arg_sorstr
  10. long obj_si,ls_cnt=500
  11. obj_si=pos(obj_str,arg_objstr)
  12. do while obj_si>0 and ls_cnt>0
  13. obj_str=replace(obj_str,obj_si,len(arg_objstr),arg_replstr)
  14. obj_si=pos(obj_str,arg_objstr)
  15. ls_cnt=ls_cnt - 1
  16. loop
  17. return obj_str
  18. end function