The Java Developers Almanac 1.4


Order this book from Amazon.

   
Home > List of Packages > java.text  [26 examples]

e305. Determining the Type of a Character

You should use the methods in the class Character to determine the properties of a character. These methods work for the entire Unicode character set.
    char ch = 'a';
    if (Character.isLetter(ch)) {      // true
    }
    if (Character.isDigit(ch)) {       // false
    }
    if (Character.isLowerCase(ch)) {   // true
    }
    if (Character.isUpperCase(ch)) {   // false
    }
    // See Character for more methods.

 Related Examples
e306. Comparing Strings in a Locale-Independent Way
e307. Iterating the Characters of a String
e308. Adding an Attribute to a String
e309. Incrementing a Double by the Smallest Possible Amount
e310. Localizing Messages

See also: Dates    Messsages    Numbers    Times    Words and Sentences   


© 2002 Addison-Wesley.