Character class Methods of Java Part - I

java.lang.Character

The Character class wraps a value of the primitive type char in an object. An object of class Character contains a single field whose type is char.

In addition, this class provides a large number of static methods for determining a character's category (lowercase letter, digit, etc.)and for converting characters from uppercase to lowercase and vice versa.


Some methods of Character class


Character.charCount()This method determines the number of char values needed to represent the specified character (Unicode code point)


charValue()This method returns the value of this Character object.


Character.codePointAt(char[] a, int index)This method returns the code point at the given index of the char array.


Character.codePointAt(char[] a, int index, int limit)This method returns the code point at the given index of the char array, where only the array elements with an index less than the limit can be used.


Character.codePointAt(CharSequence seq, int index)This method returns the code point at the given index of the CharSequence.


Character.codePointBefore(char[] a, int index)This method returns the code point preceding the given index of the char array.


Character.codePointBefore(char[] a, int index, int start)This method returns the code point preceding the given index of the char array, where only array elements with an index greater than or equal to start can be used.


Character.codePointBefore(CharSequence seq, int index)This method returns the code point preceding the given index of the CharSequence.


Character.codePointCount(char[] a, int offset, int count)This method returns the number of Unicode code points in a subarray of the char array argument. The offset argument is the index of the first char of the subarray and the count argument specifies the length of the subarray in chars.


Character.codePointCount(CharSequence seq, int beginIndex, int endIndex)This method returns the number of Unicode code points in the text range of the specified char sequence. The text range begins at the specified beginIndex and extends to the char at index endIndex - 1.


Character.codePointOf(String name)This method returns the code point value of the Unicode character specified by the given Unicode character name.


Character.compare() This method compares two char values numerically.


compareTo() This method compares two Character objects numerically.


Character.digit() This method returns the numeric value of the character ch in the specified radix.


equals()This method compares this object against the specified object. The result is true if and only if the argument is not null and is a Character object that represents the same char value as this object.


Character.forDigit()This method determines the character representation for a specific digit in the specified radix. If the value of radix is not a valid radix, or the value of a digit is not a valid digit in the specified radix, the null character('\u005Cu0000') is returned.


Character.getDirectionality()This method returns the Unicode directionality property for the given character. Character directionality is used to calculate the visual ordering of text.


Character.getName() This method returns the Unicode name of the specified character codePoint, or null if the code point is unassigned.


Character.getNumericValue() This method returns the int value that the specified Unicode character represents.


Character.getType() This method returns a value indicating a character's general category.


Some more Methods of Character class Part - II


Some more Methods of Character class Part -III


Some more Methods of Character class Part -IV


No comments:

Post a Comment