Skip to content

Instantly share code, notes, and snippets.

@tenntenn
Created November 8, 2014 20:42
Show Gist options
  • Save tenntenn/7e559d130f15a442edaf to your computer and use it in GitHub Desktop.
Save tenntenn/7e559d130f15a442edaf to your computer and use it in GitHub Desktop.
ひらがなかカタカナなのか判定したい #golang ref: http://qiita.com/tenntenn/items/b0fa4dcd5e2f54a373aa
func In(r rune, ranges ...*RangeTable) bool
package main
import (
"fmt"
"unicode"
)
func main() {
for _, r := range "あいうえおアイウエオアイウエオ" {
fmt.Println(string(r), "is Hiragana", unicode.In(r, unicode.Hiragana))
fmt.Println(string(r), "is Katakana", unicode.In(r, unicode.Katakana))
}
}
func ToLowerSpecial(_case unicode.SpecialCase, s string) string
type CaseRange struct {
Lo uint32
Hi uint32
Delta d
}
type d [MaxCase]rune
unicode.CaseRange{
Lo: ...,
Hi: ...,
Delta: [unicode.MaxCase]rune{0, 0x131 - 0x49, 0},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment