String length: Difference between revisions

Content added Content deleted
Line 1,823: Line 1,823:
int actual_length = str.codePointCount(0, str.length()); // value is 1, which is the length in characters</syntaxhighlight>
int actual_length = str.codePointCount(0, str.length()); // value is 1, which is the length in characters</syntaxhighlight>
===Grapheme Length===
===Grapheme Length===

Since JDK 20<ref>https://bugs.openjdk.org/browse/JDK-8291660</ref>.

<syntaxhighlight lang="java">import java.text.BreakIterator;
<syntaxhighlight lang="java">import java.text.BreakIterator;