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
lines
words
Try this one:
import Data.List (unfoldr) separateBy :: Eq a => a -> [a] -> [[a]] separateBy chr = unfoldr sep where sep [] = Nothing sep l = Just . fmap (drop 1) . break (== chr) $ l
Only works for a single char, but should be easily extendable.