<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><div dir="auto"><div dir="auto">Dear Chen-san,</div><div dir="auto"><br></div><div dir="auto">The beginIndex there is just a mistake that must have been removed. </div><div dir="auto"><br></div><div dir="auto">String.codePointCount()</div><div dir="auto"><br></div><div dir="auto">is the correct suggestion, as you can imagine. I am sorry for the confusion.<br><div dir="auto"><br></div><div dir="auto">Regards, </div><div dir="auto"><br></div><div dir="auto">Tatsunori Uchino</div></div><div><br><div class="elided-text">2025/08/12 7:29 Chen Liang <chen.l.liang@oracle.com>:<br type="attribution"><blockquote style="margin:0 0 0 0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">
<div style="font-family:'calibri light' , 'helvetica light' , sans-serif;font-size:12pt;color:rgb( 0 , 0 , 0 )">
Hi Uchino, I think your request is sensible in general.</div>
<div style="font-family:'calibri light' , 'helvetica light' , sans-serif;font-size:12pt;color:rgb( 0 , 0 , 0 )">
<br>
</div>
<div style="font-family:'calibri light' , 'helvetica light' , sans-serif;font-size:12pt;color:rgb( 0 , 0 , 0 )">
Do you intend to require a beginIndex for the codePointCount for String? I think a no-arg version suffices.</div>
<div style="font-family:'calibri light' , 'helvetica light' , sans-serif;font-size:12pt;color:rgb( 0 , 0 , 0 )">
<br>
</div>
<div style="font-family:'calibri light' , 'helvetica light' , sans-serif;font-size:12pt;color:rgb( 0 , 0 , 0 )">
Also forwarding this to i18n-dev as it is the locale-related list.</div>
<div style="font-family:'calibri light' , 'helvetica light' , sans-serif;font-size:12pt;color:rgb( 0 , 0 , 0 )">
<br>
</div>
<div style="font-family:'calibri light' , 'helvetica light' , sans-serif;font-size:12pt;color:rgb( 0 , 0 , 0 )">
P.S. When you reply, make sure you click "Reply all" so all the recipients of this current mail gets your reply. Otherwise, the reply is only sent to me, and others on the list won't see your reply.</div>
<div style="font-family:'calibri light' , 'helvetica light' , sans-serif;font-size:12pt;color:rgb( 0 , 0 , 0 )">
<br>
</div>
<div style="font-family:'calibri light' , 'helvetica light' , sans-serif;font-size:12pt;color:rgb( 0 , 0 , 0 )">
Regards, Chen</div>
<div></div>
<hr style="display:inline-block;width:98%">
<div dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> core-libs-dev <core-libs-dev-retn@openjdk.org> on behalf of Uchino Tatsunori <tats.u@live.jp><br>
<b>Sent:</b> Monday, August 11, 2025 6:54 AM<br>
<b>To:</b> core-libs-dev@openjdk.org <core-libs-dev@openjdk.org><br>
<b>Subject:</b> I'd like add no-argument overloads to CharSequence, String, and StringBuilder (JDK-8364007)</font>
<div> </div>
</div>
<div><font size="2"><span style="font-size:11pt">
<div>Dear core-libs developers,<br>
<br>
I'd like to add the following overloads:<br>
<br>
• Character.codePointCount(CharSequence seq)<br>
• Character.codePointCount(char[] a)<br>
• String.codePointCount(int beginIndex)<br>
• StringBuffer.codePointCount()<br>
• StringBuilder.codePointCount()<br>
<br>
and created a patch (<a href="https://github.com/openjdk/jdk/pull/26461">https://github.com/openjdk/jdk/pull/26461</a>).<br>
<br>
Why:<br>
<br>
There have already been similar overloads with the start and end indicies by JSR 204 (JDK-4985217). They are thought to have been designed with a priority on versatility. They make the specification of indices mandatory, but have the following disadvantages:<br>
<br>
1. The string expression have to be written twice. Unlike C#, Java has no equivalent of extended methods.<br>
2. Unneccesary boundary checks are mixed in.<br>
3. The most userland code tries to calculate the number of code points in the entire stirng.<br>
4. Some other languages can count the number of code points in a single function without extra arguments (e.g. len() in Python3)<br>
<br>
For 3., e.g.:<br>
<br>
• VARCHAR in MySQL & PostgreSQL counts the number of characters in the unit of code points. e.g. VARCHAR(20) means that the limit is 20 code points, not 20 UTF-16 code units (20 chars in Java)<br>
• NIST Special Publication 800-63B stiplates that the password length must be counted as the unit of code points. (Quote from
<a href="https://pages.nist.gov/800-63-3/sp800-63b.html#-5112-memorized-secret-verifiers">
https://pages.nist.gov/800-63-3/sp800-63b.html#-5112-memorized-secret-verifiers</a> : "For purposes of the above length requirements, each Unicode code point SHALL be counted as a single character.")<br>
<br>
I would like to get agreement on these changes and would like to know what I have to do outside of GitHub (e.g how to submit CSRs). If you have a GitHub account, it would be helpful if you could reply to the PR. If not, you can reply directly to this email.<br>
<br>
Best Regards,<br>
<br>
Tatsunori Uchino <br>
<a href="https://github.com/tats-u/">https://github.com/tats-u/</a></div>
</span></font></div>
</div>
</blockquote></div><br></div></div>