Core Java Tutorial

Core Java Tutorial

StringBuilder Example Program for offsetByCodePoints(int index,int codePointOffset)

Following simple example program to demonstrate how offsetByCodePoints(int index,int codePointOffset) using StringBuilder.

[java]

/**
*@author:candidjava.com
*@description:StringBuilder Example Program for offsetByCodePoints(int index,int codePointOffset)
*/

class Offsetbyte
{
public static void main(String[] args)
{
String s=”offset by code points”;

//check the condition with string s
int i=s.offsetByCodePoints(12,5);
System.out.println(i);
}
}

[/java]

Output:

17