Node.js examples for String:Case
Convert String to Hankaku Case
String.prototype.toHankakuCase = function() { var c, i = this.length, a = []; while(i--)/*w w w . j a v a2s .c o m*/ { c = a[i] = this.charCodeAt(i); switch(true) { case (0xFF01 <= c && c <= 0xFF5E): a[i] -= 0xFEE0; break; case (c == 0x3000): a[i] = 0x0020; break; }; }; return String.fromCharCode.apply(null, a); };