Java Character toTitleCase() MethodThe 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 |