How can I combine multiple splitting criterion when using Haskell package split?

Viewed 107

i use Data.List.Split from split on Hackage to split a text into sublists at ". " (period followed by blank) with

split (keepDelimsR $ onSublist ". "  )

but I would like to split on multiple sequence (i.e. "? " (question mark, blank), possibly others. From the documentation in split i cannot see how to use multiple (more than one character) conditions to split.

Anybody knows a solution? Thank you!

1 Answers

I ended up with break and a lambda expression like

break (\t ->   isPrefixOf' "a"  t
            || isPrefixOf' "ab" t
            || isPrefixOf' "aac" t
       ) input

not really nice nor clever, but does the trick. Note: break has similar functionality as split but expects a condition as argument.

Related