The first post of the blog, about simple operations on character char,
char, one of the basic data types of Java, the underlying layer saves two bytes int integers. The default display is the character at the index position of the Unicode int integer. The specific one will not be explained in detail.
Version 1: The following has the query whether the number, letter, or upper case letter, and get the int representation of the character.
Although simple, it also means it can be enhanced.
package cn.util;/** * Character tool class: some simple operation methods. * * @author jxlys @version1.0 */public class CharUtil { /** * Return the int value corresponding to the character. * * @param c */ public static int getInt(char c) { return (int) c; } /** * Detect whether letters* * @param c * @return */ public static boolean isLetterCharacter(char c) { return isUpperCharacter(c) || isLowerCharacter(c) ? true : false; } /** * Detect capital * * @param c */ public static boolean isLowerCharacter(char c) { return (c >= 97 && c < 123) ? true : false; } /** * Detect whether it is a number. * * @param c */ public static boolean isNumber(char c) { return c >= 48 && c < 58 ? true : false; } /** * Detect lowercase. * * @param c */ public static boolean isUpperCharacter(char c) { return (c >= 65 && c < 91) ? true : false; } private CharUtil() {// Constructor throw is not allowed new RuntimeException(); }}The above article about the simple tool class CharUtil sharing of Java Char Util is all the content I share with you. I hope you can give you a reference and I hope you can support Wulin.com more.