Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


On 09/26/2011 01:30 AM, Neil Leathers wrote:
I was looking into the Easy Hacks: "Removal/Replacement of the String/UniString/ByteString with 
OUString/OString once and for all" and ran into needing to translate a SearchAndReplaceAscii. Before 
launching into this set I wanted to confirm that instead of moving the SearchAndReplace functions to OUString 
and OString they should be moved to OUStringBuffer and OStringBuffer?

No, it would probably be better placed at OUString (where it returns a new OUString instance, leaving the original intact) than at OUStringBuffer (where it modifies this instance). The reason is that putting it at OUStringBuffer would typically only pay off for repeated calls to SearchAndReplace or SearchAndReplaceAll, but such repeated calls are typically also subtly broken. (Imagine code that shall replace in str1 all occurrences of "%foo%" with str2 and all occurrences of "%bar%" with str3;

  str1.SearchAndReplaceAll("%foo%", str2);
  str1.SearchAndReplaceAll("%bar%", str3);

is in general broken -- consider, e.g., the case where str2 is "%bar%".) IIRC, there should be a thread on this in the interface-discuss or interface-announce mailing lists at openoffice.org.

-Stephan

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.