Does Go have any method or there is a suggestion how to check if a string contains only ASCII characters? What is the right way to do it?
From my research, one of the solution is to check whatever there is any char greater than 127.
func isASCII(s string) bool {
for _, c := range s {
if c > unicode.MaxASCII {
return false
}
}
return true
}