add extend
This commit is contained in:
		
							
								
								
									
										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();
 | 
				
			||||||
		Reference in New Issue
	
	Block a user