js-codepoints
js-codepoints copied to clipboard
make your javascript handle unicode codepoints more correctly
codepoints.js
make your javascript handle unicode codepoints more correctly
SYNOPSIS
'𠮷野家'.length; // 4 // unfortunately
'𠮷野家'.codepoints; // 3 // naturally
String.fromCodePoint(0x20BB7); // '𠮷'
'𠮷野家'.codePointAt(0); // 0x20BB7
'𠮷野家'.uCharAt(0); // 𠮷
'𠮷野家'.toArrayOfUChars(); // ['𠮷','野','家']
'𠮷野家'.replace(RegExp.RE_UCHARS, '!'); // '!!!'
