-
-
Save dimm999/d735472df1c86f5dbbd870bfeadc69c4 to your computer and use it in GitHub Desktop.
JS clear string function
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
//in: 123������������������������� | |
//out: 123 | |
function cleanString(input) { | |
var output = ""; | |
for (var i=0; i<input.length; i++) { | |
if (input.charCodeAt(i) <= 127) { | |
output += input.charAt(i); | |
} | |
} | |
return output; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment