Is there a standard way to split a string in Haskell?
lines
and words
work great from splitting on a space or newline, but surely there is a standard way to split on a comma?
I couldn't find it on Hoogle.
To be specific, I'm looking for something where split "," "my,comma,separated,list"
returns ["my","comma","separated","list"]
.
Best Answer
Remember that you can look up the definition of Prelude functions!
http://www.haskell.org/onlinereport/standard-prelude.html
Looking there, the definition of
words
is,So, change it for a function that takes a predicate:
Then call it with whatever predicate you want!