<i18n dev> RFR: 8364007: Add no-argument codePointCount method to CharSequence and String [v20]
Alan Bateman
alanb at openjdk.org
Sun Feb 1 08:33:11 UTC 2026
On Sun, 1 Feb 2026 06:28:49 GMT, Tatsunori Uchino <duke at openjdk.org> wrote:
>> Adds `codePointCount()` overloads to `String`, `Character`, `(Abstract)StringBuilder`, and `StringBuffer` to make it possible to conveniently retrieve the length of a string as code points without extra boundary checks.
>>
>>
>> if (superTremendouslyLongExpressionYieldingAString().codePointCount() > limit) {
>> throw new Exception("exceeding length");
>> }
>>
>>
>> Is a CSR required to this change?
>
> Tatsunori Uchino has updated the pull request incrementally with two additional commits since the last revision:
>
> - Update JavaDoc
> - Fix broken test methods calls
src/java.base/share/classes/java/nio/X-Buffer.java.template line 2062:
> 2060: /**
> 2061: * {@return the number of Unicode code points in this character buffer}
> 2062: * <p>The number of Unicode code points in this character buffer is
Keep it consistent with the existing methods if you can, meaning put a blank after before the second paragraph, space after the `<p>` and drop the trailing `</p>`.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26461#discussion_r2750747902
More information about the i18n-dev
mailing list