본문으로 건너뛰기
토파즈6.0 · 출시 전
다운로드 →

문서 검색

명세 6.0

방향키로 결과를 고르고 Enter를 눌러 여세요.

API 이름, 진단 번호, 규칙 또는 프로젝트 주제를 입력하세요.

    라이브러리

    std.parser.isAsciiAlphaCode

    Tests whether a code point is an ASCII letter.

    isAsciiAlphaCode(cp: int) -> bool
    수신자
    해당 없음
    최소 인자 수
    1
    최대 인자 수
    1

    Declaration and parameters

    링크

    사용 조건

    기본 포함 · 미정

    Import std.parser in language mode 5.21.

    The current compiler selects std/parser.tpz for this language mode. Availability in other released editions and inclusion in each installed distribution are Pending.

    수신자

    매개변수 제약

    isAsciiDigitCode returns true for integers from 48 through 57, inclusive. These are the ASCII digits from 0 through 9.

    isAsciiAlphaCode returns true for integers from 65 through 90 or from 97 through 122, inclusive. These are ASCII uppercase and lowercase letters.

    isAsciiAlnumCode returns true when the digit predicate or the letter predicate returns true.

    isAsciiWhitespaceCode returns true for 9, 10, 11, 12, 13, and 32. These represent tab, line feed, vertical tab, form feed, carriage return, and space.

    Every other int returns false. Negative values, surrogate code values, non ASCII characters, and integers above the Unicode range do not cause a diagnostic.

    Each call evaluates its input once. Classification has no side effects and does not consult a locale, normalize text, or fold case.

    결과

    효과

    실패

    Result and effects

    링크

    Classify the integer with the exact ASCII set in the integer classification contract. Values outside that set return false.

    Related entries

    링크

    std.parser →

    Classify integer ASCII codes

    링크
    규칙topaz.stdlib.contract.parser-ascii-codes.rule

    Classify integer ASCII codes

    isAsciiDigitCode returns true for integers from 48 through 57, inclusive. These are the ASCII digits from 0 through 9.

    isAsciiAlphaCode returns true for integers from 65 through 90 or from 97 through 122, inclusive. These are ASCII uppercase and lowercase letters.

    isAsciiAlnumCode returns true when the digit predicate or the letter predicate returns true.

    isAsciiWhitespaceCode returns true for 9, 10, 11, 12, 13, and 32. These represent tab, line feed, vertical tab, form feed, carriage return, and space.

    Every other int returns false. Negative values, surrogate code values, non ASCII characters, and integers above the Unicode range do not cause a diagnostic.

    Each call evaluates its input once. Classification has no side effects and does not consult a locale, normalize text, or fold case.

    이유

    Exact integer sets make ASCII parsing independent of host text rules. A false result handles a value outside the class without introducing an error channel.

    Include each ASCII endpoint and exclude its neighbors

    링크
    main.tpzInclude each ASCII endpoint and exclude its neighbors플레이그라운드 열기 →
    1. import std.parser
    2. import std.io
    3. for cp in ([47, 48, 57, 58, 64, 65, 90, 91, 96, 97, 122, 123, 8, 9, 10, 11, 12, 13, 14, 31, 32, 33]) {
    4. let digit = parser.isAsciiDigitCode(cp)
    5. let alpha = parser.isAsciiAlphaCode(cp)
    6. let alnum = parser.isAsciiAlnumCode(cp)
    7. let space = parser.isAsciiWhitespaceCode(cp)
    8. io.writeLine("{digit}/{alpha}/{alnum}/{space}")
    9. }
    기대 출력종료 코드 0
    false/false/false/false
    true/false/true/false
    true/false/true/false
    false/false/false/false
    false/false/false/false
    false/true/true/false
    false/true/true/false
    false/false/false/false
    false/false/false/false
    false/true/true/false
    false/true/true/false
    false/false/false/false
    false/false/false/false
    false/false/false/true
    false/false/false/true
    false/false/false/true
    false/false/false/true
    false/false/false/true
    false/false/false/false
    false/false/false/false
    false/false/false/true
    false/false/false/false
    
    $ topaz run main.tpz · 대상 제품 5.21.3
    기대 결과

    기대 결과

    실행을 마칩니다. 종료 코드 0.

    기대 표준 출력
    1. false/false/false/false
    2. true/false/true/false
    3. true/false/true/false
    4. false/false/false/false
    5. false/false/false/false
    6. false/true/true/false
    7. false/true/true/false
    8. false/false/false/false
    9. false/false/false/false
    10. false/true/true/false
    11. false/true/true/false
    12. false/false/false/false
    13. false/false/false/false
    14. false/false/false/true
    15. false/false/false/true
    16. false/false/false/true
    17. false/false/false/true
    18. false/false/false/true
    19. false/false/false/false
    20. false/false/false/false
    21. false/false/false/true
    22. false/false/false/false

    Return false for invalid code points and non ASCII values

    링크
    main.tpzReturn false for invalid code points and non ASCII values플레이그라운드 열기 →
    1. import std.parser
    2. import std.io
    3. for cp in ([-1, 128, 233, 55296, 1114112, 9223372036854775807]) {
    4. let digit = parser.isAsciiDigitCode(cp)
    5. let alpha = parser.isAsciiAlphaCode(cp)
    6. let alnum = parser.isAsciiAlnumCode(cp)
    7. let space = parser.isAsciiWhitespaceCode(cp)
    8. io.writeLine("{digit}/{alpha}/{alnum}/{space}")
    9. }
    기대 출력종료 코드 0
    false/false/false/false
    false/false/false/false
    false/false/false/false
    false/false/false/false
    false/false/false/false
    false/false/false/false
    
    $ topaz run main.tpz · 대상 제품 5.21.3
    기대 결과

    기대 결과

    실행을 마칩니다. 종료 코드 0.

    기대 표준 출력
    1. false/false/false/false
    2. false/false/false/false
    3. false/false/false/false
    4. false/false/false/false
    5. false/false/false/false
    6. false/false/false/false

    메뉴

    다운로드 →