Reputation: 1131
In Unicode there are some existing defined range unicode range, I'm looking for something so that given a rune
I can find its Unicode Script.
In the unicode
package I found this function, but it doesn't seem to do what I want.
chineseChars := "人人"
for _, rune := range chineseChars {
fmt.Println(unicode.In(rune, unicode.Bopomofo))
}
This piece of code prints false
when it should print true
Upvotes: 0
Views: 98
Reputation: 121129
The unicode package puts 人
in Han, not Bopomofo. The expression unicode.In('人', unicode.Han)
evaluates to true
.
Upvotes: 1