【发布时间】:2018-01-29 19:36:11
【问题描述】:
我有一小段代码可以将字符串转换为 Int32
Dim sample As String = "H۩llo!"
For Each c As Char In sample
Dim enc As String = Convert.ToInt32(c)
Console.Write(enc + " ")
Next
Console.ReadKey()
这会将文本转换为 Int32 输出:
72 1769 108 108 111 33
但是有没有办法将输出转换回“H۩llo!”?
【问题讨论】:
-
另一个选项是
Dim chars = int32Chars.Select(Function(n) Char.ConvertFromUtf32(n)),然后你可以使用Dim text = String.Join("", chars)