So che puoi convertire un String
in un numero con read
:
Prelude> read "3" :: Int
3
Prelude> read "3" :: Double
3.0
Ma come afferrare la String
rappresentazione di un Int
valore?
So che puoi convertire un String
in un numero con read
:
Prelude> read "3" :: Int
3
Prelude> read "3" :: Double
3.0
Ma come afferrare la String
rappresentazione di un Int
valore?
Risposte:
L'opposto di read
è show
.
Prelude> show 3
"3"
Prelude> read $ show 3 :: Int
3