String manipulation.

Hal Daume III hdaume@ISI.EDU
Thu, 7 Feb 2002 09:53:58 -0800 (PST)

You should have a look at the Read class.  A member a of the Read class
has a function read :: String -> a.

so, for example, you can say:

  (read "5.0") :: Double

to read this as a double.  You could also read it as an integer or

If you have a list of strings that you want to convert to a list of
integers, you could do:

  map (\x -> (read x)::Double) [list of strings]

Hope that helps.

 - Hal

Hal Daume III

 "Computer science is no more about computers    |
  than astronomy is about telescopes." -Dijkstra |

On Thu, 7 Feb 2002, DK wrote:

> Hello. First of all I am a beginner in Haskell, and I must confess I do not yet fully understand it. I need to write a program in Haskell, though, and I am having some difficulties... 
> What I would like to ask, is how can I take a string from a list, and manipulate it, in order to convert it to an integer. Any help would be very appreciated.
> Thank you very much,
>     Dimitris