[RFC] StringBuilder.toCharArray

Martin Buchholz martinrb at google.com
Wed Jul 18 23:29:39 UTC 2018


You can already copy a StringBuilder's contents into a String or another
StringBuilder.
What would Josh say? "Doesn't pull its weight." ?!

On Wed, Jul 18, 2018 at 7:29 AM, Isaac Levy <isaac.r.levy at gmail.com> wrote:

> Is there any interest in a toCharArray method for StringBuilder?  I'm
> unable to to make a bug for it.
>
> Just a bit of sugar:
>
> char[] toCharArray() {
>   int length = length();
>   char[] dst = new char[length];
>   getChars(0, length, dst, 0);
>   return dst;
> }
>
> Regards,
> Isaac
>


More information about the core-libs-dev mailing list