Node.js examples for String:Unicode
Calculates the length of the string in utf-8
if (typeof String.prototype.utf8ByteLength != 'function') { String.prototype.utf8ByteLength = function() {// w w w . ja va 2s . c o m // Matches only the 10.. bytes that are non-initial characters in a multi-byte sequence. var m = encodeURIComponent(this).match(/%[89ABab]/g); return this.length + (m ? m.length : 0); }; };