我知道您可以使用read
将String
转换为数字:
Prelude> read "3" :: Int
3
Prelude> read "3" :: Double
3.0
但是如何获取 Int
值的 String
表示形式呢?
最佳答案
与read
相反的是show
。
Prelude> show 3
"3"
Prelude> read $ show 3 :: Int
3
关于string - Haskell:将 Int 转换为 String,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2784271/