Multisplit: Difference between revisions

J: review, clarification, and added missing variable from example
m (Mark solutions as needing review)
(J: review, clarification, and added missing variable from example)
Line 8:
 
=={{header|J}}==
{{needs-review|J}}
<lang j>multisplit=:4 :0
'sep begin'=.|:t=. y /:~&.:(|."1)@;@(i.@#@[ ,.L:0"0 I.@E.L:0) x
Line 26 ⟶ 25:
First find all potentially relevant separator instances, and sort them in increasing order, by starting location and separator index. <code>sep</code> is separator index, and <code>begin</code> is starting location. <code>end</code> is ending location.
 
Then, loop through the possibilities, skipping over those separators which conflictwould withoverlap thewith currentlypreviously selectedused sequenceseparators.
 
Example use:
 
<lang j> S multisplit =:'a!==';'=b=!=';'=c'
S multisplit '==';'!=';'='
┌───┬───┬───┬───┬─┐
│a │ │b │ │c│
6,962

edits