Javascript String getBytes()
String.prototype.getBytes = function () { var bytes = []; for (var i = 0; i < this.length; i++) { bytes.push(this.charCodeAt(i));/* ww w . j av a 2s . com*/ } return bytes; };
String.prototype.getBytes = function() { var cArr = this.match(/[^\x00-\xff]/ig); return this.length + (cArr == null ? 0 : cArr.length*2); }/*from www. ja v a2 s . co m*/
String.prototype.getBytes = function () { var bytes = []; for (var i = 0; i < this.length; ++i) { bytes.push(this.charCodeAt(i));/*from ww w . j a va 2s . c o m*/ } return bytes; };