Skip to content

Instantly share code, notes, and snippets.

@jesse1981
Created April 19, 2013 05:47
Show Gist options
  • Save jesse1981/5418375 to your computer and use it in GitHub Desktop.
Save jesse1981/5418375 to your computer and use it in GitHub Desktop.
Search a string of having an upper/lower alpha character.
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