Skip to content

Instantly share code, notes, and snippets.

@huyinghuan
Created January 27, 2015 18:50
Show Gist options
  • Save huyinghuan/628d330cffda7aff300d to your computer and use it in GitHub Desktop.
Save huyinghuan/628d330cffda7aff300d to your computer and use it in GitHub Desktop.
number to char
function numToChart(queue){
var s = [];
for(var a = 0, len = queue.length; a < len; a++){
s.push(String.fromCharCode(+queue[a]))
}
return s.join('')
}
function strToNum(str){
queue = str.split('');
arr = [];
for(var i = 0, length = queue.length; i < length; i++){
arr.push(queue[i].charCodeAt())
}
return arr
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment