Files
pinyin-pro/lib/common/utils.ts
2024-04-15 14:49:38 +08:00

14 lines
329 B
TypeScript

import { DoubleUnicodeReg } from './constant';
export function getStringLength(string: string) {
return string.replace(DoubleUnicodeReg, '_').length;
}
export function isZhChar(char: string) {
if (typeof char !== 'string') {
return false;
}
let code = char.charCodeAt(0);
return code >= 19968 && code <= 40869;
}