Skip to content

Instantly share code, notes, and snippets.

@yelinaung

yelinaung/mm.go

Created Jan 6, 2016
Embed
What would you like to do?
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