[Haskell] ByteString tokens
Chad Scherrer
chad.scherrer at gmail.com
Mon Oct 2 17:54:13 EDT 2006
On 10/2/06, Duncan Coutts <duncan.coutts at worc.ox.ac.uk> wrote:
> If you need the previous implementation you can use this:
>
> -- | Like 'splitWith', except that sequences of adjacent separators are
> -- treated as a single separator. eg.
> --
> -- > tokens (=='a') "aabbaca" == ["bb","c"]
> --
> tokens :: (Word8 -> Bool) -> ByteString -> [ByteString]
> tokens f = List.filter (not.null) . splitWith f
>
> Duncan
Ok, I'll just do it that way. Thanks!
--
Chad Scherrer
"Time flies like an arrow; fruit flies like a banana" -- Groucho Marx
More information about the Haskell
mailing list