Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Find n-th occurrence of delimiter in string
#2
Finally, I succeeded with the following code, including in the case of unicode characters. Any better solution is still welcome :

Macro Macro4
Code:
Copy      Help
subject="Perigrafi;A;100;;;Y;Help;;;400;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"

str pattern=";"
str s
int i; ARRAY(CHARRANGE) a
findrx(subject pattern 0 4 a)
s.get(subject 29 43-29)
out s

for i 0 a.len-1
,int i0=a[0 i].cpMax
,int i1=a[0 i+1].cpMin
,s.get(subject  i0 i1-i0)
,out F"{i} {i0} {i1} {s}"


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)