Created
April 19, 2013 05:47
-
-
Save jesse1981/5418375 to your computer and use it in GitHub Desktop.
Search a string of having an upper/lower alpha character.
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
function hasAlpha(val,upper) { | |
if (upper) { | |
for (var i in val) { | |
if ((val.charCodeAt(i)>=65) && (val.charCodeAt(i)<=90)) return true; | |
} | |
} | |
else { | |
for (var i in val) { | |
if ((val.charCodeAt(i)>=97) && (val.charCodeAt(i)<=122)) return true; | |
} | |
} | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment