f_str_split.srf 679 B

123456789101112131415161718192021222324
  1. $PBExportHeader$f_str_split.srf
  2. global type f_str_split from function_object
  3. end type
  4. forward prototypes
  5. global subroutine f_str_split (string arg_str, string arg_spliter, ref string arg_rslt[])
  6. end prototypes
  7. global subroutine f_str_split (string arg_str, string arg_spliter, ref string arg_rslt[]);long ll_start = 1
  8. long ll_pos
  9. long ll_cnt = 0
  10. string ls_rslt[]
  11. ll_pos = pos(arg_str, arg_spliter, ll_start)
  12. do while ll_pos > 0
  13. ll_cnt++
  14. ls_rslt[ll_cnt] = mid(arg_str, ll_start, ll_pos - ll_start)
  15. ll_start = ll_pos + len(arg_spliter)
  16. ll_pos = pos(arg_str, arg_spliter, ll_start)
  17. loop
  18. ll_cnt ++
  19. ls_rslt[ll_cnt] = mid(arg_str, ll_start)
  20. arg_rslt = ls_rslt
  21. end subroutine