角色类isUpperCase()方法 (Character class isUpperCase() method)
isUpperCase() method is available in java.lang package.
isUpperCase()方法在java.lang包中可用。
isUpperCase() method is used to check whether the given char value is uppercase or not.
isUpperCase()方法用于检查给定的char值是否为大写。
isUpperCase() method does not throw an exception at the time of checking the given char value is uppercase or not.
在检查给定的char值是否为大写时, isUpperCase()方法不会引发异常。
Syntax:
句法:
public boolean isUpperCase (Char value);
Parameter(s):
参数:
Char value – represents the char value to be checked.
字符值 –表示要检查的字符值。
Return value:
返回值:
The return type of this method is boolean, it returns a boolean value based on the following cases,
此方法的返回类型为boolean ,它基于以下情况返回布尔值:
It returns true, if the given char value is uppercase.
如果给定的char值为大写,则返回true 。
It returns false, if the given char value is not in uppercase.
如果给定的char值不是大写,则返回false 。
Example:
例:
// Java program to demonstrate the example
// of boolean isUpperCase (Char value) method of Character class
public class IsUpperCaseOfCharacterClass {
public static void main(String[] args) {
// It returns true because the passing
// character is in UpperCase
boolean result1 = Character.isUpperCase('P');
// It returns false because the passing
// character is not in UpperCase
boolean result2 = Character.isUpperCase('p');
// Display values of result1 , result2
System.out.println("Character.isUpperCase('P'): " + result1);
System.out.println("Character.isUpperCase('p'): " + result2);
}
}
Output
输出量
Character.isUpperCase('P'): true
Character.isUpperCase('p'): false
翻译自: https://www.includehelp.com/java/character-class-isuppercase-method-with-example.aspx