mirror of
https://github.com/zh-lx/pinyin-pro.git
synced 2026-03-13 09:51:38 +08:00
14 lines
329 B
TypeScript
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;
|
|
}
|