summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2013-11-19 11:41:29 +0000
committerCaolán McNamara <caolanm@redhat.com>2013-11-19 15:51:26 +0000
commit06ed06d2808cad5eeea17ee94c0da0426bb6ea9f (patch)
treebc62321cf26785d9d6884961c85be3321115acb3
parentc289fb1bad21785c2aa512911da0d08f2e177ac8 (diff)
need a String::EraseAllChars-alike for OUStringBuffer
Change-Id: I189c08a4100b32b16527ae40df3a9125bf78be88
-rw-r--r--include/comphelper/string.hxx23
1 files changed, 23 insertions, 0 deletions
diff --git a/include/comphelper/string.hxx b/include/comphelper/string.hxx
index aa1b98532b61..0363d4b743c0 100644
--- a/include/comphelper/string.hxx
+++ b/include/comphelper/string.hxx
@@ -85,6 +85,29 @@ inline OUString remove(const OUString &rIn,
sal_Unicode c)
{ return rIn.replaceAll(OUString(c), OUString()); }
+/** Removes all occurrences of a character from within the source string
+
+ @param rIn The input OUStringBuffer
+ @param c The character to be removed
+
+ @return The resulting OUStringBuffer
+ */
+inline OUStringBuffer& remove(OUStringBuffer &rIn,
+ sal_Unicode c)
+{
+ sal_Int32 index = 0;
+ while (1)
+ {
+ if (index >= rIn.getLength())
+ break;
+ index = rIn.indexOf(c, index);
+ if (index == -1)
+ break;
+ rIn.remove(index, 1);
+ }
+ return rIn;
+}
+
/** Strips occurrences of a character from the start of the source string
@param rIn The input OString