Multisplit: Difference between revisions
Content added Content deleted
m (→{{header|Haskell}}: (Pruned out a couple of redundant imports)) |
|||
Line 688: | Line 688: | ||
then Nothing |
then Nothing |
||
else find (`isPrefixOf` drop i s) ds) of |
else find (`isPrefixOf` drop i s) ds) of |
||
Just x -> ([], |
Just x -> ([], (tokens, x, i) : parts, i + length x) |
||
Nothing -> |
Nothing -> |
||
( |
( if inDelim |
||
tokens |
then tokens |
||
else c : tokens |
|||
then [] |
|||
else [c]) |
|||
, parts |
, parts |
||
, offset)) |
, offset)) |
||
([], [], 0) |
([], [], 0) |
||
(zip s [0 .. lng]) |
(zip s [0 .. lng]) |
||
in |
in reverse $ (ts, [], lng) : ps |
||
main :: IO () |
main :: IO () |