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 {
//ww w.  j  av  a  2s .  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.





















Home »
  Java Tutorial »
    java.lang »




Boolean
Byte
Character
Class
Double
Enum
Float
Integer
Long
Math
Number
Object
Package
Process
ProcessBuilder
Runnable
Runtime
SecurityManager
Short
StackTraceElement
StrictMath
String
StringBuffer
StringBuilder
System
Thread
ThreadGroup
ThreadLocal
Throwable