英文:
How do I use a Unicode table to print a Tibetan character
问题
以下是藏文的Unicode字符表:
https://en.m.wikipedia.org/wiki/Tibetan_(Unicode_block)
要在fmt.Printf(mycode)语句中使用该图表中的代码来打印藏文字母ཏ,该字母位于该Unicode图表的U+0F4x行和F列。
我需要这样写吗:
Fmt.Printf("U+0F4xF")
或者类似这样的写法,还是我需要去掉“U”或“U+”?
英文:
Here is the Unicode characters table for the Tibetan language,
https://en.m.wikipedia.org/wiki/Tibetan_(Unicode_block)
How to I use the codes in that chart in a fmt.Printf(mycode) statement, in order to print, say the Tibetan letter ཏ, which is located at line U+0F4x and column F of that unicode chart.
Do I have to write:
Fmt.Printf(“U+0F4xF”)
or something like that, or do I have to drop the “U” or the “U+“ ?
答案1
得分: 4
打印ཏ(U+0F4F藏文字母TA)(或任何其他Unicode字符),您可以直接将字符放入字符串文字中,使用\u0F4F
转义,或使用相应的符文(Unicode代码点):
fmt.Printf("直接:ཏ\n")
fmt.Printf("转义:\u0F4F\n")
fmt.Printf("符文:%c\n", rune(0x0F4F))
Go博客中有一些详细信息...
英文:
To print ཏ (U+0F4F TIBETAN LETTER TA) (or any other Unicode character), you can put the character directly into your string literal, use a \u0F4F
escape, or use the correspoding rune (Unicode codepoint):
fmt.Printf("Direct: ཏ\n")
fmt.Printf("Escape: \u0F4F\n")
fmt.Printf("Rune: %c\n", rune(0x0F4F))
The Go blog has some details...
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论