package lattice import "unicode" // IsCyrillic returns true if s contains at least one Cyrillic letter // and no Latin letters. Returns false for empty strings, digit-only // strings, or strings with mixed scripts. func IsCyrillic(s string) bool { hasCyrillic := false for _, r := range s { if unicode.Is(unicode.Latin, r) { return false } if unicode.Is(unicode.Cyrillic, r) { hasCyrillic = true } } return hasCyrillic } // IsLatin returns true if s contains at least one Latin letter // and no Cyrillic letters. Returns false for empty strings, digit-only // strings, or strings with mixed scripts. func IsLatin(s string) bool { hasLatin := false for _, r := range s { if unicode.Is(unicode.Cyrillic, r) { return false } if unicode.Is(unicode.Latin, r) { hasLatin = true } } return hasLatin }