Re: Strtok-v2-1.e problem

new topic     » goto parent     » topic index » view thread      » older message » newer message

Haflidi Asgrimsson wrote:
> 
> include Strtok-v2-1.e
> sequence s
> s = parse("1__2_3_4_5",{"k","_"})
> puts(1,s[1])
> 
> gives 1__2_3_4_5
> :p
> 
> 
> include kparse.e
> sequence s
> s = Kparse("1__2_3_4_5","_")
> for i = 1 to length(s) do
> 	puts(1,s[i] & ",")
> end for
> 
> gives 1,,2,3,4,5,
> 
> thanx!
> 
It's a differnt abstraction. Single charector delimiters only.

Kparse evaluates the arguement "_" and '_' the same 
If you pass "^_" it bookmarks each delimiter position concurrently.

Kparse2(sequence,"^_")  will evaluate the first delimiter 
 then each list element will be broken down by the second delimiter
 I haven't worked out a recursive routine yet to handle more than 2. 


s= "Joe^Doe|123456^F|NO CHANGE"
  
Kparse(s,"|^") gives "Joe","Doe","123456","F","NO CHANGE"
Kparse2(s,"|^") gives {"Joe","Doe"},{"123456","F"},{"NO CHANGE"}
 
Kparse2(s,{
            "|_><,\"
           ,"!@#$%^*"
          }
        )
 is also valid

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu