Skip to content

Instantly share code, notes, and snippets.

@yelinaung
Created January 6, 2016 12:44
Show Gist options
  • Save yelinaung/370757a9b942d244490a to your computer and use it in GitHub Desktop.
Save yelinaung/370757a9b942d244490a to your computer and use it in GitHub Desktop.
package main
import "fmt"
import "unicode/utf8"
func main() {
str1 := "ခ"
str2 := "a"
str3 := "界"
myStr := "ကဿခ"
for x, y := range myStr {
fmt.Println(x, y)
}
y1, _ := utf8.DecodeLastRuneInString(str1)
y2, _ := utf8.DecodeLastRuneInString(str2)
y3, _ := utf8.DecodeLastRuneInString(str3)
isMyanmar(y1)
isMyanmar(y2)
isMyanmar(y3)
ka := "က"
kha := "ခ"
ka1, _ := utf8.DecodeLastRuneInString(ka)
kha1, _ := utf8.DecodeLastRuneInString(kha)
fmt.Println("is Myanmar Ka ?", isMyanmarKa(ka1))
fmt.Println("is Myanmar Kha ?", isMyanmarKa(kha1))
}
func isMyanmar(str rune) {
if str > '\u1000' && str < '\u109f' {
fmt.Println(str, "yup")
} else {
fmt.Println(str, "nope")
}
}
func isMyanmarKa(r rune) bool {
if r == '\u1000' {
return true
}
return false
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment