const CHINESE_RANGE: &[[u32; 2]] = &[
[0x4e00, 0x9fff], [0xff0c, 0xff0c], [0x3002, 0x3002], [0x00b7, 0x00b7], [0x00d7, 0x00d7], [0x2014, 0x2014], [0x2018, 0x2018], [0x2019, 0x2019], [0x201c, 0x201c], [0x201d, 0x201d], [0x2026, 0x2026], [0x3001, 0x3001], [0x300a, 0x300a], [0x300b, 0x300b], [0x300e, 0x300e], [0x300f, 0x300f], [0x3010, 0x3010], [0x3011, 0x3011], [0xff01, 0xff01], [0xff08, 0xff08], [0xff09, 0xff09], [0xff1a, 0xff1a], [0xff1b, 0xff1b], [0xff1f, 0xff1f], [0x3400, 0x4dbf], [0x20000, 0x2a6df], [0x2a700, 0x2b73f], [0x2b740, 0x2b81f], [0x2b820, 0x2ceaf], [0x3300, 0x33ff], [0xfe30, 0xfe4f], [0xf900, 0xfaff], [0x2f800, 0x2fa1f], ];
pub fn is_chinese(str: &str) -> bool {
let has_ascii = str.chars().any(|c| c as u32 <= 255);
if has_ascii {
return false;
}
let is_all_chinese = str.chars().all(|c| {
CHINESE_RANGE
.iter()
.any(|&[start, end]| c as u32 >= start && c as u32 <= end)
});
is_all_chinese
}