• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 309
  • Last Modified:

Visible/Printable characters

How do I make Java tell me whether a certain character is a printable character, such as digits, letters, punctuation signs, whitespace etc. (all characters that have some effect when added for instance to a text field), such do NOT include chars like backspace, delete, F(1-12), home, end etc.
Looking through the static methods of class Character I didn't find anything that would do that.
0
Sasha_M
Asked:
Sasha_M
  • 2
  • 2
1 Solution
 
vladi21Commented:

     * Determines if the specified character is an ISO control character.
     * A character is considered to be an ISO control character if its
     * code is in the range \u0000 through \u001F or in the range
     * \u007F through \u009F.
     *
     * @param   ch      the character to be tested.
     * @return  true if the character is an ISO control character;
     *          false otherwise.
     *
     * @see     java.lang.Character#isSpaceChar(char)
     * @see     java.lang.Character#isWhitespace(char)
     * @since   JDK1.1
     */
    public static boolean isISOControl(char ch) {
      return (ch <= 0x009F) && ((ch <= 0x001F) || (ch >= 0x007F));
    }
0
 
Sasha_MAuthor Commented:
What's an ISO control character? :-)
0
 
vladi21Commented:
chars like backspace, delete, F(1-12), home, end etc :)
0
 
Sasha_MAuthor Commented:
aha, ok, thanks, will try that :-)
0

Featured Post

Learn to develop an Android App

Want to increase your earning potential in 2018? Pad your resume with app building experience. Learn how with this hands-on course.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now