Java Character toTitleCase() Method6 Nov 2024 | 4 min read The toTitleCase(char ch) method of Character class converts the given character argument to the titlercase using a case mapping information which is provided by the Unicode Data file. It should be noted that Character.isTitleCase(Character.TitleCase(ch)) may not always return true for some characters. It has been seen that if a character has no explicit titlecase mapping and is not a titlecase character as per the Unicode Data file, then an uppercase mapping is returned. On the other hand, if the character argument is already a titlecase character, then the same value will be returned. SyntaxParameterch: It is the character that needs to be converted. Return ValueThe toTitleCase(char ch) method returns the titlecase of the given character. Otherwise, this method returns the character itself. Example 1Output: The titlecase of character 'b' is given as: B The titlecase of character 'm' is given as: M Example 2Output: The titlecase of character ')' is given as: ) The titlecase of character 'G' is given as: G Java Character toTitleCase()MethodThe toTitleCase(int codePoint) method of Character class converts the given character(Unicode code point) argument to the titlercase using a case mapping information which is provided by the Unicode Data file. It should be noted that Character.isTitleCase(Character.TitleCase(codePoint)) may not always return true for some characters. It has been seen that if a character has no explicit titlecase mapping and is not a titlecase character as per the Unicode Data file, then an uppercase mapping is returned. On the other hand, if the character argument is already a titlecase character, then the same value will be returned. SyntaxParametercodePoint: It is the codePoint which is the character that needs to be tested. Return ValueThe toTitleCase(int codePoint) method returns the titlecase of the given character(Unicode code point). Otherwise, this method returns the character itself. Example 1Output: The titlecase for the character '153' isgiven as: 153 The titlecase for the character '128' isgiven as: 128 Example 2Output: The titlecase for the character '273' isgiven as: 272 The titlecase for the character '156' isgiven as: 156 Next TopicJava-character-touppercase-method |
The compareTo(character another character) method of character class is used to compare two objects numerically. Syntax publicintcompareTo(CharcteranotherCharcter ) Parameter The above method requires only one parameter: The character that need to be compared. Return The compare(char x, char y) method of character class returns : The value 0 if the given Character is equal...
2 min read
The equals(Object obj) method of character class compares the object with the specified object. The result is true if and only if the argument is not null and the Character object has the same char value as represented by the object. Syntax public boolean equals(Object obj) Parameter The above method...
2 min read
The reverseBytes(char ch) method of Character class returns the values obtained by reversing the bytes in a particular order for a given value. Syntax public static char reverseBytes(char ch) Parameter ch: It is the character that needs to be tested. Return Value The reverseBytes(char ch)method returns the value which is obtained by...
3 min read
The Character.isUnicodeIdentifierPart() method in Java checks if a given character is valid as part of a Unicode identifier. It evaluates whether the character can legally appear after the first character in identifiers, based on Unicode rules, ensuring it's a letter, digit, connecting character, or part of...
8 min read
The isWhitespace(char ch) method of Character class determines whether the given character(Unicode code point) is a whitespace character or not. A character in Java can be considered as a whitespace character if one of the following criteria is satisfied: The character is a Unicode space character (either a...
7 min read
The isLetter(char ch) method of Character class determines whether the given(or specified) character is a letter or not. A character is considered to be a letter if the general category type provided by the Character.getType(ch) is one of the following: UPPERCASE_LETTER. LOWERCASE_LETTER. TITLECASE_LETTER. MODIFIER_LETTER. OTHER_LETTER Syntax public static boolean isLetter(char ch) Parameter ch: It is the...
7 min read
The offsetByCodePoints(char[]a, int start, int count, int index, int codePointOffset) method of Character class returns the specified index within the given char sub-array which has been offset by codePointOffset codePoints. The start and count parameter specifies a sub-array of the char array. All the unpaired surrogates...
3 min read
The isSpace(char ch)method of Character class determines whether the given(or specified) character is ISO-LATIN-1 white space. The given method returns true for the following five characters: '\t' U+0009 HORIZONTAL TABULATION '\n' U+000A NEW LINE '\f' U+000C FORM FEED '\r' U+000D CARRIAGE RETURN ' '...
2 min read
The Character.isTitleCase(char ch) method in Java checks if a given character is a title-case character. Title-case characters are typically used at the start of words in languages where capitalization rules apply. This method returns true if the character isTitleCase(); otherwise, it returns false. It belongs...
8 min read
The isSpaceChar(char ch) method of Character class determines whether the given(or specified) character is a Unicode space character. The given(or specified) character is considered to be a space character if the character is specified as a space character by the Unicode Standard. The above method returns true...
4 min read
We request you to subscribe our newsletter for upcoming updates.
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India