mirror of
https://github.com/mattermost/mattermost.git
synced 2026-04-13 13:08:56 -04:00
19 lines
378 B
Go
19 lines
378 B
Go
|
|
package model
|
||
|
|
|
||
|
|
import (
|
||
|
|
"unicode"
|
||
|
|
)
|
||
|
|
|
||
|
|
// ContainsCJK returns true if the string contains any CJK (Chinese, Japanese, Korean) characters.
|
||
|
|
func ContainsCJK(s string) bool {
|
||
|
|
for _, r := range s {
|
||
|
|
if unicode.Is(unicode.Han, r) ||
|
||
|
|
unicode.Is(unicode.Hiragana, r) ||
|
||
|
|
unicode.Is(unicode.Katakana, r) ||
|
||
|
|
unicode.Is(unicode.Hangul, r) {
|
||
|
|
return true
|
||
|
|
}
|
||
|
|
}
|
||
|
|
return false
|
||
|
|
}
|