Skip to content

Instantly share code, notes, and snippets.

@BrambleXu
Created March 8, 2019 00:27
Show Gist options
  • Save BrambleXu/268ce0c57154db17b3efc7422323028e to your computer and use it in GitHub Desktop.
Save BrambleXu/268ce0c57154db17b3efc7422323028e to your computer and use it in GitHub Desktop.
var fs = require('fs');
var text = fs.readFileSync('./unicode_plane.txt');
var lines = text.toString().split('\n')
for (i=0; i < lines.length; i++) {
// console.log(lines[i].split(' '));
unicode_char = lines[i].split(' ')[0];
count = lines[i].split(' ')[1];
// test for not use spread operator
// if (unicode_char.length !== parseInt(count)) {
// console.log(unicode_char, count, unicode_char.length.toString())
// };
// test for spread operator
if ([...unicode_char].length !== parseInt(count)) {
console.log(unicode_char, count, [...unicode_char].length.toString())
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment