當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript unicode-properties.getCategory函數代碼示例

本文整理匯總了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
    );
}
開發者ID:nrkn,項目名稱:quicktype,代碼行數:31,代碼來源:Strings.ts

示例2: isPartCharacter

function isPartCharacter(utf16Unit: number): boolean {
    const category: string = unicode.getCategory(utf16Unit);
    return ["Nd", "Pc", "Mn", "Mc"].indexOf(category) >= 0 || isStartCharacter(utf16Unit);
}
開發者ID:nrkn,項目名稱:quicktype,代碼行數:4,代碼來源:Objective-C.ts

示例3: isNumeric

export function isNumeric(codePoint: number): boolean {
    const category = unicode.getCategory(codePoint);
    return ["No", "Nd", "Nl"].indexOf(category) >= 0;
}
開發者ID:nrkn,項目名稱:quicktype,代碼行數:4,代碼來源:Strings.ts

示例4: isDigit

export function isDigit(codePoint: number): boolean {
    const category = unicode.getCategory(codePoint);
    return ["Nd"].indexOf(category) >= 0;
}
開發者ID:nrkn,項目名稱:quicktype,代碼行數:4,代碼來源:Strings.ts

示例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;
}
開發者ID:nrkn,項目名稱:quicktype,代碼行數:5,代碼來源:Strings.ts


注:本文中的unicode-properties.getCategory函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。