Last active
March 10, 2017 09:08
-
-
Save Chadtech/b76bbfefbc796bf43fd498e2b490cef3 to your computer and use it in GitHub Desktop.
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
allAlphanumeric : String -> Bool | |
allAlphanumeric str = | |
List.map isAlphanumeric (String.toList str) | |
|> List.foldr (||) False | |
isAlphanumeric : Char -> Bool | |
isAlphanumeric char = | |
String.contains (String.fromChar char) alphanumeric | |
alphanumeric : String | |
alphanumeric = | |
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvxwyz0123456789" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You could also achieve this pretty succinctly using regex and partial application, like this. :)