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
_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice

Reply via email to