[Libreoffice-commits] core.git: include/comphelper

Tor Lillqvist tml at collabora.com
Thu May 29 05:17:23 PDT 2014


 include/comphelper/string.hxx |    8 ++++++++
 1 file changed, 8 insertions(+)

New commits:
commit ee0d7d4c52fe93ef2ac73d403f61b642f1ae2716
Author: Tor Lillqvist <tml at collabora.com>
Date:   Thu May 29 15:16:32 2014 +0300

    Add function to catenate n copies of a string
    
    Change-Id: Iba203e18fea2a374e0e0b5c988012ee8fd5369e7

diff --git a/include/comphelper/string.hxx b/include/comphelper/string.hxx
index 181ca8b..a0c68ae 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


More information about the Libreoffice-commits mailing list