Java examples for java.lang:char
Indicates if the given character is alphabetical (a-z or A-Z).
//package com.java2s; public class Main { /**/*from w w w.ja v a2s .co m*/ * Indicates if the given character is alphabetical (a-z or A-Z). * * @param character * The character to test. * @return True if the given character is alphabetical (a-z or A-Z). */ public static boolean isAlpha(int character) { return isUpperCase(character) || isLowerCase(character); } /** * Indicates if the given character is upper case (A-Z). * * @param character * The character to test. * @return True if the given character is upper case (A-Z). */ public static boolean isUpperCase(int character) { return (character >= 'A') && (character <= 'Z'); } /** * Indicates if the given character is lower case (a-z). * * @param character * The character to test. * @return True if the given character is lower case (a-z). */ public static boolean isLowerCase(int character) { return (character >= 'a') && (character <= 'z'); } }