On Thu, Nov 30, 2006 at 05:47:43PM -0800, Huazhi (Hank) Gong wrote:
> 
> Like given a string list s="This is the string I want to test", I want to get
> the substring. In ruby or other language, it's simple like s[2..10], but how
> to do it in Haskell?

Use take and drop, from the Prelude:

(ghci session)
Prelude> "Hello world"
"Hello world"
Prelude> drop 3 "Hello world"
"lo world"
Prelude> take 7 (drop 3 "Hello world")
"lo worl"
Prelude>
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to