String Character Length: Difference between revisions

Line 176:
 
Since Java 1.5, the actual number of characters can be determined by calling the codePointCount method.
String str = "\uD834\uDD2A"; //U+1D12A
int length = str.codePointCount(0, str.length);
int length1 = str.length(); //2
int lengthlength2 = str.codePointCount(0, str.length()); //1
 
==[[JavaScript]]==
Anonymous user