From fce720b3e4691eb3b7deef1d005d76b23123a5cb Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Thu, 8 Oct 2015 08:33:09 +0200 Subject: comphelper: add string::join() If there is a need for it, this could be extended later to work with uno sequences and/or OUStrings as well. Change-Id: Id0af8b1755c8e4b668720563d10a052337e1b2c9 --- comphelper/source/misc/string.cxx | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'comphelper') diff --git a/comphelper/source/misc/string.cxx b/comphelper/source/misc/string.cxx index c5637966f5a2..8384e7325e12 100644 --- a/comphelper/source/misc/string.cxx +++ b/comphelper/source/misc/string.cxx @@ -270,6 +270,17 @@ uno::Sequence< OUString > return kws; } +OString join(const OString& rSeparator, const std::vector& rSequence) +{ + OStringBuffer aBuffer; + for (size_t i = 0; i < rSequence.size(); ++i) + { + if (i != 0) + aBuffer.append(rSeparator); + aBuffer.append(rSequence[i]); + } + return aBuffer.makeStringAndClear(); +} sal_Int32 compareNatural( const OUString & rLHS, const OUString & rRHS, const uno::Reference< i18n::XCollator > &rCollator, -- cgit