本文整理匯總了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;
}