Skip to content

Instantly share code, notes, and snippets.

@rickt
Last active August 29, 2015 14:02
Show Gist options
  • Save rickt/a8432a1a47a272d82fab to your computer and use it in GitHub Desktop.
Save rickt/a8432a1a47a272d82fab to your computer and use it in GitHub Desktop.
check to see if something is ASCII or not
package main
import "fmt"
func isASCII(s string) bool {
for _, c := range s {
if c > 127 {
return false
}
}
return true
}
func main() {
fmt.Println(isASCII("Hello, playground"))
fmt.Println(isASCII("ಠ_ಠ"))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment