List of utility methods to do String to Binary Convert
toBin()String.prototype.toBin = function() { var st,i,j,d; var arr = []; var len = this.length; for (i = len; i>0; i--) { d = this.charCodeAt(i-1); for (j = 0; j < 8; j++) { arr[arr.length] = d%2; d = Math.floor(d/2); ... | |
toBinary()String.prototype.toBinary = function() { for (var i = 1, j = this.length, $ = this.charCodeAt(0).toString(2); i<j; i++) $ += ' ' + this.charCodeAt(i).toString(2); return $; }; | |
toBinary()String.prototype.toBinary = function(){ var ret = ''; for (var i = 0; i < this.length; i++) { ret += this.charCodeAt(i).toString(2); return ret; |