How do I use a Unicode table to print a Tibetan character

huangapple go评论74阅读模式
英文:

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...

huangapple
  • 本文由 发表于 2021年8月8日 18:42:47
  • 转载请务必保留本文链接:https://go.coder-hub.com/68699997.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定