f_split.srf 678 B

12345678910111213141516171819202122232425262728
  1. $PBExportHeader$f_split.srf
  2. global type f_split from function_object
  3. end type
  4. forward prototypes
  5. global subroutine f_split (string arg_source, string arg_spliter, ref string arg_return[])
  6. end prototypes
  7. global subroutine f_split (string arg_source, string arg_spliter, ref string arg_return[]);string arg_rslt[]
  8. long ll_cnt = 0
  9. long ll_pos = 0
  10. do while len(arg_source) > 0
  11. ll_pos = pos(arg_source, arg_spliter)
  12. if ll_pos > 0 then
  13. ll_cnt++
  14. arg_rslt[ll_cnt] = mid(arg_source, 1, ll_pos - 1)
  15. arg_source = mid(arg_source, ll_pos + len(arg_spliter))
  16. else
  17. ll_cnt++
  18. arg_rslt[ll_cnt] = arg_source
  19. arg_source = ''
  20. end if
  21. loop
  22. arg_return = arg_rslt
  23. end subroutine