diff options
-rw-r--r-- | comphelper/source/misc/string.cxx | 11 | ||||
-rw-r--r-- | include/comphelper/string.hxx | 4 |
2 files changed, 15 insertions, 0 deletions
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<OString>& 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, diff --git a/include/comphelper/string.hxx b/include/comphelper/string.hxx index 0609e623fc47..780d89e5eb2a 100644 --- a/include/comphelper/string.hxx +++ b/include/comphelper/string.hxx @@ -23,6 +23,7 @@ #include <sal/config.h> #include <cstddef> +#include <vector> #include <comphelper/comphelperdllapi.h> #include <sal/types.h> #include <rtl/strbuf.hxx> @@ -310,6 +311,9 @@ COMPHELPER_DLLPUBLIC sal_Int32 indexOfAny(OUString const& rIn, COMPHELPER_DLLPUBLIC OUString convertCommaSeparated( ::com::sun::star::uno::Sequence< OUString > const & i_rSeq); +/// Return a string which is the concatenation of the strings in the sequence. +COMPHELPER_DLLPUBLIC OString join(const OString& rSeparator, const std::vector<OString>& rSequence); + /** Convert a decimal string to a number. The string must be base-10, no sign but can contain any |