Here you can find the source of fromAscii85()
String.prototype.fromAscii85 = function() { var ret = ""; var str = this.replace(/\s+/g, "").replace("z", "!!!!!").slice(2, -2); for(var i=0; i<str.length; i+=5){ var deficit = Math.max(0, 5+i-str.length); var nnn = 0;/* w w w . j av a 2 s .c o m*/ for(var j=0; j<5; j++){ nnn = nnn*85 + (str.charCodeAt(i+j) || 117) - 33; } var codes = []; for(var j=0; j<4; j++){ codes.push(nnn%256); nnn = nnn/256 | 0; } codes.reverse(); var chunk = String.fromCharCode.apply(undefined, codes).slice(0, 4-deficit); ret+= chunk; } return ret; }
String.prototype.fromAscii85 = function() { var str = this.slice(2, -2).replace(/\s/g, ''), result = '' while (str.length) { if (str[0] == 'z') { result += '\u0000\u0000\u0000\u0000' str = str.substr(1) } else { let num = 0, j = 5, i = 4 while (j--) { ...
String.prototype.fromAscii85 = function() { var str = this.slice(2, -2).replace(/z/g, '!!!!!').replace(/\s/g, ''); var decoded = ''; for(var i = 0, len = str.length; i < len; i+=5) { var n = 0; var us = 0; for(var j = 4; j >= 0; j--) { var c = str[j+i] || (us++, 'u'), code = c.charCodeAt(0) - 33; ...
String.prototype.fromAscii85 = function() { console.log(this) let pad = 'u', addnum = 0, s = this.substring(2, this.length - 2).replace(/\s/g, ''), str = '', res = ''; for (let i = 0; i < s.length; i++) str += s[i] === 'z' ? '!!!!!' : s[i]; while (str.length % 5 !== 0) str += pad; addnum ++; ...