summaryrefslogtreecommitdiffstats
path: root/comphelper/source
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2016-05-03 12:59:05 +0300
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2016-06-18 17:02:08 +0200
commit0d4dcf380033902fe4eb70425138e419fb711271 (patch)
treed1c7ddc3d62d7bc787e8b84d942ca5e0b333de39 /comphelper/source
parentuitest: this comment has been fixed (diff)
downloadcore-0d4dcf380033902fe4eb70425138e419fb711271.tar.gz
core-0d4dcf380033902fe4eb70425138e419fb711271.zip
add comphelper::string::split
Change-Id: Iccc989a786e8e7b8dca1996b635248d7bf7fc5d8
Diffstat (limited to 'comphelper/source')
-rw-r--r--comphelper/source/misc/string.cxx29
1 files changed, 20 insertions, 9 deletions
diff --git a/comphelper/source/misc/string.cxx b/comphelper/source/misc/string.cxx
index 2dbbc0c90d11..db035eb22967 100644
--- a/comphelper/source/misc/string.cxx
+++ b/comphelper/source/misc/string.cxx
@@ -253,19 +253,30 @@ OUString convertCommaSeparated(
return buf.makeStringAndClear();
}
-uno::Sequence< OUString >
- convertCommaSeparated( OUString const& i_rString )
+std::vector<OUString>
+ split(const OUString& rStr, sal_Unicode cSeparator)
{
std::vector< OUString > vec;
sal_Int32 idx = 0;
- do {
- OUString kw =
- i_rString.getToken(0, static_cast<sal_Unicode> (','), idx);
- kw = kw.trim();
- if (!kw.isEmpty()) {
- vec.push_back(kw);
- }
+ do
+ {
+ OUString kw =
+ rStr.getToken(0, cSeparator, idx);
+ kw = kw.trim();
+ if (!kw.isEmpty())
+ {
+ vec.push_back(kw);
+ }
+
} while (idx >= 0);
+
+ return vec;
+}
+
+uno::Sequence< OUString >
+ convertCommaSeparated( OUString const& i_rString )
+{
+ std::vector< OUString > vec = split(i_rString, ',');
return comphelper::containerToSequence(vec);
}