oluwabunmi
oluwabunmi

Reputation: 31

non printable characters in java

Please, can you give me a list of non printable characters in java programming? Thank you in advance.

Upvotes: 1

Views: 5153

Answers (3)

Jörn Horstmann
Jörn Horstmann

Reputation: 34044

Are spaces printable? What about the private use area? Please modify the code to your definition of "printable" :)

import static java.lang.Character.*;

for (int i=0; i<MAX_CODE_POINT; i++) {
    int t = getType(i);
    boolean p = t == CONTROL || t == CONNECTOR_PUNCTUATION || t == CURRENCY_SYMBOL || t == DASH_PUNCTUATION || t == DECIMAL_DIGIT_NUMBER || t == ENCLOSING_MARK || t == END_PUNCTUATION || t == FINAL_QUOTE_PUNCTUATION || t == INITIAL_QUOTE_PUNCTUATION || t == LETTER_NUMBER || t == LOWERCASE_LETTER || t == MATH_SYMBOL || t == MODIFIER_LETTER || t == MODIFIER_SYMBOL || t == OTHER_LETTER || t == OTHER_NUMBER || t == OTHER_PUNCTUATION || t == OTHER_SYMBOL || t == START_PUNCTUATION || t == TITLECASE_LETTER || t == UPPERCASE_LETTER;
    if (!p) {
        System.out.println("Non printable codepoint " + i);
    }
}        

Upvotes: 1

Matt Ball
Matt Ball

Reputation: 360016

Java uses the Unicode standard, so you should be asking about non-printable (non-printing?) characters in Unicode.

http://en.wikipedia.org/wiki/Unicode_control_characters

Upvotes: 4

JSBձոգչ
JSBձոգչ

Reputation: 41388

Java strings are unicode strings. Unicode doesn't have a concept of "non-printable" characters, exactly, but the ASCII non-printable range, along with several other characters, are considered Unicode control characters.

Upvotes: 1

Related Questions