[Libreoffice-commits] .: sal/inc

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Nov 21 08:04:30 PST 2012


 sal/inc/rtl/ustrbuf.hxx |   20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

New commits:
commit bf246fce77cdfac7e031d93a912d0bf2071a6e5e
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date:   Mon Nov 19 22:34:35 2012 -0600

    a replace() to OUStringBuffer
    
    Change-Id: I2cbfeea9800ad656c49ce1cae7ff1f4b830f1442
    Reviewed-on: https://gerrit.libreoffice.org/1139
    Reviewed-by: Norbert Thiebaud <nthiebaud at gmail.com>
    Tested-by: Norbert Thiebaud <nthiebaud at gmail.com>

diff --git a/sal/inc/rtl/ustrbuf.hxx b/sal/inc/rtl/ustrbuf.hxx
index a82a30b..25195f1 100644
--- a/sal/inc/rtl/ustrbuf.hxx
+++ b/sal/inc/rtl/ustrbuf.hxx
@@ -924,6 +924,26 @@ public:
         return *this;
     }
 
+    /**
+       Replace all occurrences of
+       oldChar in this string buffer with newChar.
+
+       @since LibreOffice 4.0
+
+       @param    oldChar     the old character.
+       @param    newChar     the new character.
+       @return   this string buffer
+    */
+    OUStringBuffer& replace( sal_Unicode oldChar, sal_Unicode newChar )
+    {
+        sal_Int32 index = 0;
+        while((index = indexOf(oldChar, index)) >= 0)
+        {
+            pData->buffer[ index ] = newChar;
+        }
+        return *this;
+    }
+
     /** Allows access to the internal data of this OUStringBuffer, for effective
         manipulation.
 


More information about the Libreoffice-commits mailing list