string.codePointCount()
string.codePointCount() Returns the number of unicodes present within a range ( start and end value ) inside a string.
Syntax
string.codePointCount(input_start, input_end)
Inputs are integers showing staring and ending of range. (
Here are some examples with output.
String my_str="Welcome to plus2net";
System.out.println(my_str.codePointCount(0,10)); // 10
Learn more about unicode values of the Chars here
Total number of unicode chars present in a string.
String my_str="Welcome to plus2net";
System.out.println(my_str.codePointCount(0,my_str.length())); // 19
System.out.println(my_str.length()); // 19
« All String functions
« Java
This article is written by plus2net.com team.
plus2net.com