Last active
August 29, 2015 14:02
-
-
Save rickt/a8432a1a47a272d82fab to your computer and use it in GitHub Desktop.
check to see if something is ASCII or not
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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