我知道这听起来很简单,但我没能将两个字符串组合成一个新字符串。
来自 gtk 条目的 IO 字符串“a”由
a <- (entryGetText text_field)
目标是将其组合为:
newstring = "文本:"+a
有什么想法可以实现吗?
谢谢!
最佳答案
使用字符串连接:
do a <- entryGetText text_field
let b = "Text:" ++ a
return b
更简单地说:
do a <- entryGetText text_field
return $ "Text:" ++ a
你也可以玩游戏:
("Text:" ++) <$> (entryGetText text_field)
关于string - 如何在 Haskell 中连接两个(IO)字符串?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10755852/