Efficient string concatenation

Norbert Thiebaud nthiebaud at gmail.com
Sun Dec 2 16:58:29 PST 2012


On Sun, Dec 2, 2012 at 6:55 PM, Norbert Thiebaud <nthiebaud at gmail.com> wrote:

Sorry fro previous post. mishap...

> On Sun, Dec 2, 2012 at 4:56 PM, Lubos Lunak <l.lunak at suse.cz> wrote:
>>
>>  Hello,
>>
>>  The work is based on threads [1] and [2] and occassionally seeing in the
>> commits that people doing string cleanups sometimes change ugly code to only
>> slightly less ugly code. With the new feature enabled, any string
>> concatenation/creation is simply done as (well, ok, the number() part is not
>> done yet, but shouldn't be difficult to add):
>>
>> OUString s = foo + bar + "baz" + OUString::number( many ) + "whatever";
>>
>> All the other alternatives, like explicit OUStringBuffer and repeated append()
>> should be now worse in all possible aspects.
>

What is the recommended way to deal with
for(xxxx)
{
      sString += foo;
}

OUStringBuffer is still the way to go in that case right ?

Norbert


More information about the LibreOffice mailing list