java中不可打印的字符

时间:2010-06-29 15:30:54

标签: java special-characters

拜托,你能给我一个java编程中不可打印字符的列表吗?提前谢谢。

3 个答案:

答案 0 :(得分:4)

Java使用Unicode标准,因此您应该询问Unicode中的不可打印(非打印?)字符。

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

答案 1 :(得分:1)

Java字符串是unicode字符串。 Unicode完全没有“不可打印”字符的概念,但ASCII不可打印范围以及其他几个字符被视为Unicode control characters

答案 2 :(得分:1)

空格是否可打印?私人使用区怎么样?请将代码修改为“可打印”的定义:)

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);
    }
}