-1
当我想打印出字形簇其中从U + 0021以U + 0100以Unicode表的代码点错误打印Unicode字形集群由for循环
for i in 21...100 {
print("\u{i} ", terminator: "")
}
编译器呈现我以下错误
问题:我想我不能用指数从for循环数组作为字符串解释Unicode标指标。如果是这样,我应该改变使用循环正确
非常感谢
当我想打印出字形簇其中从U + 0021以U + 0100以Unicode表的代码点错误打印Unicode字形集群由for循环
for i in 21...100 {
print("\u{i} ", terminator: "")
}
编译器呈现我以下错误
问题:我想我不能用指数从for循环数组作为字符串解释Unicode标指标。如果是这样,我应该改变使用循环正确
非常感谢
的\u{n}
特殊字符只能与一个文字十六进制数n
什么步骤。 但是你可以从其数值创造一个Unicode标:
for i in 0x21...0x100 {
print(UnicodeScalar(i), terminator: "")
}
非常感谢Martin – SLN
我不知道SWIFT所以这可能是完全错误的,但你需要从int到字符铸。 – Casey
当我在21 ... 21'时,你期望输出什么? – OOPer
查看http://stackoverflow.com/questions/25799413/converting-to-char-string-from-ascii-int-in-swift或甚至http://stackoverflow.com/questions/34259425/how-to-convert -an-int-a-character-in-swift –