Sunday, September 3, 2017

Java - Character Class

Source Link:
https://www.tutorialspoint.com/java/java_characters.htm

Some Useful Methods:

isLetter()
Determines whether the specified char value is a letter.

isDigit()
Determines whether the specified char value is a digit.

isWhitespace()
Determines whether the specified char value is white space.

isUpperCase()
Determines whether the specified char value is uppercase.

isLowerCase()
Determines whether the specified char value is lowercase.

toUpperCase()
Returns the uppercase form of the specified char value.

toLowerCase()
Returns the lowercase form of the specified char value.

toString()
Returns a String object representing the specified character value that is, a one-character string.

Example: 
public class Test {
   public static void main(String args[]) {
      System.out.println(Character.isLetter('c'));
      System.out.println(Character.isLetter('5'));
   }
}
This will produce the following result −
true 
false
 

No comments:

Post a Comment

Codility - Lesson 16 Greedy algorithms - 2. MaxNonoverlappingSegments

Source Link: https://app.codility.com/programmers/lessons/16-greedy_algorithms/max_nonoverlapping_segments/ Question: Located on a line ...