add extend
This commit is contained in:
parent
88dea913c3
commit
d9508f34d5
3141
data-friendly.json
3141
data-friendly.json
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
33
print-all-chinese-characters.js
Normal file
33
print-all-chinese-characters.js
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
/**
|
||||||
|
* javascript 输出所有汉字
|
||||||
|
* refer: https://zhidao.baidu.com/question/1641830754970388060.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
汉字范围
|
||||||
|
\u4E00-\u9FA5
|
||||||
|
*/
|
||||||
|
// 分析
|
||||||
|
// unescape("%u4E00") // "一"
|
||||||
|
// parseInt("4E00", 16) // 19968
|
||||||
|
// parseInt('9FA5', 16) // 40869
|
||||||
|
// (19968).toString(16) // "4e00"
|
||||||
|
// 实现
|
||||||
|
function printChar() {
|
||||||
|
let a = []
|
||||||
|
var start = 19968;
|
||||||
|
var end = 40869;
|
||||||
|
var maxCount = end - start;
|
||||||
|
function transform(n) {
|
||||||
|
return unescape("%u" + n.toString(16));
|
||||||
|
}
|
||||||
|
function print(data) {
|
||||||
|
// console.log(data);
|
||||||
|
a.push(data)
|
||||||
|
}
|
||||||
|
for (var n = 0; n < maxCount; n++) {
|
||||||
|
print(transform(start + n));
|
||||||
|
}
|
||||||
|
console.log(a.join(''))
|
||||||
|
}
|
||||||
|
printChar();
|
Loading…
Reference in New Issue
Block a user