touppercase
字符类的toUpperCase()方法 (Character class toUpperCase() method)
toUpperCase() method is available in java.lang package.
toUpperCase()方法在java.lang包中可用。
toUpperCase() method is used to return the uppercase character of the given char value.
toUpperCase()方法用于返回给定char值的大写字符。
toUpperCase() method does not throw an exception at the time of representing lowercase character to uppercase character or uppercase to the uppercase character.
在将小写字符表示为大写字符或将大写字符表示为大写字符时, toUpperCase()方法不会引发异常。
Syntax:
句法:
public char toUpperCase (Char value);
Parameter(s):
参数:
Char value – represents the char value to be converted.
字符值 –表示要转换的字符值。
Return value:
返回值:
The return type of this method is char, it returns the uppercase conversion of the given char value.
此方法的返回类型为char ,它返回给定char值的大写转换。
Example:
例:
// Java program to demonstrate the example
// of char toUpperCase (Char value) method of Character class
public class ToUpperCaseOfCharacterClass {
public static void main(String[] args) {
// It returns P because the passing character is
// already in UpperCase
char result1 = Character.toUpperCase('P');
// It returns P because the passing character will
// be converted to UpperCase by using toUpperCase()
char result2 = Character.toUpperCase('p');
// Display values of result1 , result2
System.out.println("Character.toUpperCase('P'): " + result1);
System.out.println("Character.toUpperCase('p'): " + result2);
}
}
Output
输出量
Character.toUpperCase('P'): P
Character.toUpperCase('p'): P
翻译自: https://www.includehelp.com/java/character-class-touppercase-method-with-example.aspx
touppercase