[Haskell-beginners] beginner question
Brent Yorgey
byorgey at seas.upenn.edu
Fri Oct 30 13:47:23 EDT 2009
On Fri, Oct 30, 2009 at 01:40:13PM +0000, Luca Ciciriello wrote:
>
> Hi all.
>
> Just a very basic question.
>
> I need to write a function str2lsts :: String -> [[String]] in order to transorm a string like:
>
> "\"1\",\"cat\",\"dog\"§\"2\",\"duck\",\"goose\""
>
> in the list of lists:
>
> [["1","cat","dog"],["2","duck","goose"]]
Another possibility:
import Data.List.Split -- from the 'split' package on Hackage
str2lsts = map (splitOn ",") . splitOn "@" . filter (/='"')
-Brent
More information about the Beginners
mailing list