List of utility methods to do String Encode
encode()String.prototype.encode = function() { var reference = "abcdefghijklmnopqrstuvwxyz !'.?;,"; var encoding = ",;?.'! zyxwvutsrqponmlkjihgfedcba"; var input = this.valueOf().toLowerCase(); var output = ""; var n, p; for (n=0; n<input.length; n++) { p = reference.indexOf(input.charAt(n)); output += encoding.charAt(p); ... | |
encode()String.prototype.encode = function() { return encodeURIComponent( String( this ) ); }; | |
encode(str)String.prototype.encode = function(str) { var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; var encoded = []; var c = 0; while (c < str.length) { var b0 = str.charCodeAt(c++); var b1 = str.charCodeAt(c++); var b2 = str.charCodeAt(c++); var buf = (b0 << 16) + ((b1 || 0) << 8) + (b2 || 0); ... |