[Haskell-cafe] Can i split a String by its element ?

Brent Yorgey byorgey at seas.upenn.edu
Tue Feb 22 17:51:43 CET 2011


Prelude Data.List.Split> (splitOn [0] . map read . splitOn ",") "2,15,33,0,8,1,16,18"
[[2,15,33],[8,1,16,18]]

-Brent

On Tue, Feb 22, 2011 at 12:03:45AM -0700, Luke Palmer wrote:
> See the http://hackage.haskell.org/package/split package.  You should
> be able to do this by splitting the string on comma, and then
> splitting the result on 0, plus some plumbing.
> 
> Luke
> 
> On Mon, Feb 21, 2011 at 11:46 PM, z_axis <z_axis at 163.com> wrote:
> >
> > I want to split "2,15,33,0,8,1,16,18" to ([2,15,33],[8,1,16,18]).  the "0"
> > will by discarded.
> >
> > However, it seems that there isnot any standard function to do it.
> >
> >
> > Sincerely!
> >
> > -----
> > e^(π.i) + 1 = 0
> > --
> > View this message in context: http://haskell.1045720.n5.nabble.com/Can-i-split-a-String-by-its-element-tp3395066p3395066.html
> > Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.
> >
> > _______________________________________________
> > Haskell-Cafe mailing list
> > Haskell-Cafe at haskell.org
> > http://www.haskell.org/mailman/listinfo/haskell-cafe
> >
> 
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe



More information about the Haskell-Cafe mailing list