diff options
author | Norbert Thiebaud <nthiebaud@gmail.com> | 2012-11-19 22:34:35 -0600 |
---|---|---|
committer | Norbert Thiebaud <nthiebaud@gmail.com> | 2012-11-21 16:03:59 +0000 |
commit | bf246fce77cdfac7e031d93a912d0bf2071a6e5e (patch) | |
tree | 02f28bee86f68fbdc92f733ee0aab13f4a8602f5 /sal | |
parent | 07f4845e485c5582089fa5551b874be600a94018 (diff) |
a replace() to OUStringBuffer
Change-Id: I2cbfeea9800ad656c49ce1cae7ff1f4b830f1442
Reviewed-on: https://gerrit.libreoffice.org/1139
Reviewed-by: Norbert Thiebaud <nthiebaud@gmail.com>
Tested-by: Norbert Thiebaud <nthiebaud@gmail.com>
Diffstat (limited to 'sal')
-rw-r--r-- | sal/inc/rtl/ustrbuf.hxx | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/sal/inc/rtl/ustrbuf.hxx b/sal/inc/rtl/ustrbuf.hxx index a82a30b15995..25195f1434da 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. |