Write a java program to count a number of Unicode code points in the specified text range of a String.

Java Programming Language String in java (Article) String in java (Program)

1582

Program:

public class Exercise {

 public static void main(String[] args) {

    String str = "atnyla.com";
    System.out.println("Original String : " + str);

    // codepoint from index 1 to index 10
    int ctr = str.codePointCount(1, 10);

    // prints character from index 1 to index 10
    System.out.println("Codepoint count = " + ctr);
  }
}

Output:

Original String : atnyla.com
Codepoint count = 9
Press any key to continue . . .

Explanation:

None

This Particular section is dedicated to Programs only. If you want learn more about Java Programming Language. Then you can visit below links to get more depth on this subject.