summaryrefslogtreecommitdiff
path: root/include/comphelper/string.hxx
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2014-05-29 15:16:32 +0300
committerTor Lillqvist <tml@collabora.com>2014-05-29 15:16:51 +0300
commitee0d7d4c52fe93ef2ac73d403f61b642f1ae2716 (patch)
treeca161a9f6cab6e69eb9f167d77984d88cf1cf4bb /include/comphelper/string.hxx
parent5dfb6e74c68073eb1742c53393c683d5841de255 (diff)
Add function to catenate n copies of a string
Change-Id: Iba203e18fea2a374e0e0b5c988012ee8fd5369e7
Diffstat (limited to 'include/comphelper/string.hxx')
-rw-r--r--include/comphelper/string.hxx8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/comphelper/string.hxx b/include/comphelper/string.hxx
index 181ca8b92a6e..a0c68ae1bbe5 100644
--- a/include/comphelper/string.hxx
+++ b/include/comphelper/string.hxx
@@ -308,6 +308,14 @@ COMPHELPER_DLLPUBLIC inline OUStringBuffer& padToLength(
return detail::padToLength(rBuffer, nLength, cFill);
}
+COMPHELPER_DLLPUBLIC inline OUString duplicate(const OUString& rString, int nCopies)
+{
+ if (nCopies <= 0)
+ return OUString("");
+ else
+ return rString + duplicate(rString, nCopies-1);
+}
+
/** Replace a token in a string
@param rIn OUString in which the token is to be replaced
@param nToken which nToken to replace