Character.toLowerCase(): This method is available in java.lang.Character class of Java.
Approach 1: When the argument is of type char.
Syntax:
char java.lang.Character.toLowerCase(char ch)
This method takes one argument of type char as its parameter. This method converts the character argument to lowercase using case mapping information from the UnicodeData file.
Parameters: One parameter is required for this method.
ch: the character to be converted.
Returns: the lowercase equivalent of the character, if any; otherwise, the character itself.
Exceptions: NA
Java
public class CharactertoLowerCasechar {public static void main(String[] args) {char ch = 'A';System.out.println(Character.toLowerCase(ch));}}
Output:
a
Approach 2: When the argument is of type int.
Syntax:
int java.lang.Character.toLowerCase(int codePoint)
This method takes one argument of type int as its parameter. This method converts the character (Unicode code point) argument to lowercase using case mapping information from the Unicode Datafile.
Parameters: One parameter is required for this method.
codePoint: the character (Unicode code point) to be converted.
Returns: the lowercase equivalent of the character (Unicode codepoint), if any; otherwise, the character itself.
Exceptions: NA
Java
public class CharactertoLowerCaseint {public static void main(String[] args) {int codePoint = 'A';System.out.println(Character.toLowerCase(codePoint));}}
Output:
No comments:
Post a Comment