Java Character .offsetByCodePoints (CharSequence seq, int index, int codePointOffset)

Syntax

Character.offsetByCodePoints(CharSequence seq, int index, int codePointOffset) has the following syntax.

public static int offsetByCodePoints(CharSequence seq,   int index,   int codePointOffset)

Example

In the following code shows how to use Character.offsetByCodePoints(CharSequence seq, int index, int codePointOffset) method.


public class Main {
/*  ww w.j a v  a 2  s  .co m*/
   public static void main(String[] args) {
      CharSequence seq = "Hello World";
      int res = Character.offsetByCodePoints(seq, 3, 8);

      String str = "The index within the char sequence seq 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