VOOZH about

URL: https://www.geeksforgeeks.org/java/character-ishighsurrogate-method-in-java-with-examples/

⇱ Character.isHighSurrogate() method in Java with examples - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Character.isHighSurrogate() method in Java with examples

Last Updated : 6 Dec, 2018
The java.lang.Character.isHighSurrogate() is a inbuilt method in java which determines if the given char value is a Unicode high-surrogate code unit (also known as leading-surrogate code unit). Such values do not represent characters by themselves but are used in the representation of supplementary characters in the UTF-16 encoding. Syntax:
public static boolean isHighSurrogate(char ch)
Parameters: The function accepts a single mandatory parameter ch which specifies the value to be tested. Return Value: The function returns a boolean value. The value returned is True if the char value is between MIN_HIGH_SURROGATE and MAX_HIGH_SURROGATE inclusive, False otherwise. Below programs illustrate the Character.isHighSurrogate() method: Program 1:
Output:
c1 is a Unicodehigh-surrogate code unit ? false
c2 is a Unicodehigh-surrogate code unit ? true
Program 2:
Output:
c1 is a Unicodehigh-surrogate code unit ? false
c2 is a Unicodehigh-surrogate code unit ? false
Comment