Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Character.isLetterOrDigit(char) returns different value in java 6 and 7

Tags:

java

The following code snippet returns 46059 on Java 6 and 48757 on Java 7. Any ideas what might have changed?

int i = 0;
for(char c = Character.MIN_VALUE; c < Character.MAX_VALUE; c++){
    if(Character.isLetterOrDigit(c)){
        i++;
    }
}
System.out.println(i);
like image 988
Anand Nalya Avatar asked Sep 27 '13 11:09

Anand Nalya


1 Answers

I suspect this document holds the answer:

New Scripts and Characters from Unicode 6.0.0
Early versions of the Java SE 7 release added support for Unicode 5.1.0. The final version of the Java SE 7 release supports Unicode 6.0.0. Unicode 6.0.0 is a major version of the Unicode Standard and adds support for over 2000 additional characters, as well as support for properties and data files.

like image 97
Jon Skeet Avatar answered Oct 19 '22 21:10

Jon Skeet