Skip to content

Instantly share code, notes, and snippets.

@A1rPun
Created April 10, 2015 11:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save A1rPun/a03361cf1c4d300d2859 to your computer and use it in GitHub Desktop.
Save A1rPun/a03361cf1c4d300d2859 to your computer and use it in GitHub Desktop.
Convert a string to keys on your keyboard
function convertStringToInput(str){
var result = [];
for (var i = 0, l = str.length; i < l; i++) {
var charCode = str.charCodeAt(i);
result.push(charCode > 255 ? '+' + charCode.toString(16) : charCode);
}
return result.join(' ');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment