Github user PascalSchumacher commented on a diff in the pull request: https://github.com/apache/commons-text/pull/50#discussion_r122294037 --- Diff: src/main/java/org/apache/commons/text/CharacterPredicates.java --- @@ -48,5 +48,73 @@ public boolean test(int codePoint) { public boolean test(int codePoint) { return Character.isDigit(codePoint); } - } + }, + + /** + * Tests if the code points represents a number between 0 and 9. + * + * @since 1.2 + */ + ARABIC_NUMERALS { + @Override + public boolean test(int codePoint) { + return codePoint >= ZERO_CODEPOINT && codePoint <= NINE_CODEPOINT; + } + }, + + /** + * Tests if the code points represents a letter between a and z. + * + * @since 1.2 + */ + ASCII_LOWERCASE_LETTERS { + @Override + public boolean test(int codePoint) { + return codePoint >= LOWERCASE_A_CODEPOINT && codePoint <= LOWERCASE_Z_CODEPOINT; + } + }, + + /** + * Tests if the code points represents a letter between A and Z. + * + * @since 1.2 + */ + ASCII_UPPERCASE_LETTERS { + @Override + public boolean test(int codePoint) { + return codePoint >= UPPERCASE_A_CODEPOINT && codePoint <= UPPERCASE_Z_CODEPOINT; + } + }, + + /** + * Tests if the code points represents a letter between a and Z. + * + * @since 1.2 + */ + ASCII_LETTERS { + @Override + public boolean test(int codePoint) { + return ASCII_LOWERCASE_LETTERS.test(codePoint) || ASCII_UPPERCASE_LETTERS.test(codePoint); + } + }, + + /** + * Tests if the code points represents a letter between a and Z or a number between 0 and 9. + * + * @since 1.2 + */ + ASCII_ALPHA_NUMERALS { + @Override + public boolean test(int codePoint) { + return ASCII_LOWERCASE_LETTERS.test(codePoint) || ASCII_UPPERCASE_LETTERS.test(codePoint) + || ARABIC_NUMERALS.test(codePoint); + } + }; + + private static final int NINE_CODEPOINT = 57; --- End diff -- Sure. I have updated the pull request. Thanks for the suggestion!
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org