Created
May 2, 2016 15:06
-
-
Save marcusshepp/2a23d7eaa471225fcc2b8fc63c2dc7df to your computer and use it in GitHub Desktop.
Javascript check for non-ascii chars
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 is_ascii(str){ | |
for (var i = 0; i < str.length; i++) | |
if (str.charCodeAt(i) > 127) | |
return false; | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment