本文整理汇总了TypeScript中unicode-properties.getCategory函数的典型用法代码示例。如果您正苦于以下问题:TypeScript getCategory函数的具体用法?TypeScript getCategory怎么用?TypeScript getCategory使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getCategory函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: isPrintable
export function isPrintable(codePoint: number): boolean {
if (codePoint > 0xffff) return false;
const category = unicode.getCategory(codePoint);
return (
[
"Mc",
"No",
"Sk",
"Me",
"Nd",
"Po",
"Lt",
"Pc",
"Sm",
"Zs",
"Lu",
"Pd",
"So",
"Pe",
"Pf",
"Ps",
"Sc",
"Ll",
"Lm",
"Pi",
"Nl",
"Mn",
"Lo"
].indexOf(category) >= 0
);
}
示例2: isPartCharacter
function isPartCharacter(utf16Unit: number): boolean {
const category: string = unicode.getCategory(utf16Unit);
return ["Nd", "Pc", "Mn", "Mc"].indexOf(category) >= 0 || isStartCharacter(utf16Unit);
}
示例3: isNumeric
export function isNumeric(codePoint: number): boolean {
const category = unicode.getCategory(codePoint);
return ["No", "Nd", "Nl"].indexOf(category) >= 0;
}
示例4: isDigit
export function isDigit(codePoint: number): boolean {
const category = unicode.getCategory(codePoint);
return ["Nd"].indexOf(category) >= 0;
}
示例5: isLetter
export function isLetter(codePoint: number): boolean {
const category = unicode.getCategory(codePoint);
// FIXME: Include Letter, modifier (Lm)?
return ["Lu", "Ll", "Lt", "Lo"].indexOf(category) >= 0;
}