On Thu, 24 Jul 2025 14:50:07 GMT, Tatsunori Uchino <[email protected]> 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?
> 
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

This pull request has now been integrated.

Changeset: 8778be1a
Author:    Tatsunori Uchino <[email protected]>
Committer: Chen Liang <[email protected]>
URL:       
https://git.openjdk.org/jdk/commit/8778be1a1b387dfcc231e6b43dcebe68598e4993
Stats:     35 lines in 3 files changed: 25 ins; 2 del; 8 mod

8364007: Add no-argument codePointCount method to String

Reviewed-by: liach, smarks, naoto

-------------

PR: https://git.openjdk.org/jdk/pull/26461

Reply via email to