Java Data Type Tutorial - Java Character.codePointCount (CharSequence seq, int beginIndex, int endIndex)








Syntax

Character.codePointCount(CharSequence seq, int beginIndex, int endIndex) has the following syntax.

public static int codePointCount(CharSequence seq,   int beginIndex,   int endIndex)

Example

In the following code shows how to use Character.codePointCount(CharSequence seq, int beginIndex, int endIndex) method.

public class Main {
// w  w  w .ja va  2 s.  c  o m
   public static void main(String[] args) {
      CharSequence seq = "Hello World from java2s.com!";
      int beginIndex = 4, endIndex = 8;

      int res = Character.codePointCount(seq, beginIndex, endIndex);

      String str = "Number. of Unicode code points is " + res;

      System.out.println( str );
   }
}

The code above generates the following result.