Java tutorial
public class Main { public static void main(String[] args) { String str = "java2s.com"; System.out.println("String = " + str); // codepoint from index 1 to index 8 int retval = str.codePointCount(1, 8); // prints character from index 1 to index 8 System.out.println("Codepoint count = " + retval); } }