简体   繁体   English

如何通过解析转义字符串在 Haskell 中组成未转义的 Unicode 字符串?

[英]How do you compose an unescaped Unicode string in Haskell by parsing the escaped string?

["

I am parsing some text which might be "\㈀".<\/i>我正在解析一些可能是“\㈀”的文本。<\/b> Parsing this and converting to decimal, I know the integer sequence should be 12800. Now, I want to put this back together;<\/i>解析这个并转换成十进制,我知道整数序列应该是 12800。现在,我想把它放回去;<\/b> I might do the following:<\/i>我可能会做以下事情:<\/b><\/p>

toPrintedChar x = return "\\x" ++ x

To convert an integer value into a string made of that Unicode code point, it is enough to convert the number into a Char and then put it in a list.要将整数值转换为由该 Unicode 代码点组成的字符串,只需将数字转换为Char ,然后将其放入列表中即可。 Eg,例如,

myString :: String
myString = [ toEnum 12800 ]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM