summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib/strutl.cc
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2010-02-18 15:39:03 +0100
committerMichael Vogt <michael.vogt@ubuntu.com>2010-02-18 15:39:03 +0100
commit113942be71c90e7d6a9cff93cc05ac119db526de (patch)
tree2872bfb8c3b12dc8f9fe9e1622ddffeea528d4e6 /apt-pkg/contrib/strutl.cc
parentb9dacd11a4707092f070d49b1cb1acff642eebf0 (diff)
parent3c5a611808e7af5aec4c2ab12ce0bce79f74928d (diff)
merge from the lp:~donkult/apt/sid branch
Diffstat (limited to 'apt-pkg/contrib/strutl.cc')
-rw-r--r--apt-pkg/contrib/strutl.cc18
1 files changed, 18 insertions, 0 deletions
diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc
index 8e8820949..1b9922a31 100644
--- a/apt-pkg/contrib/strutl.cc
+++ b/apt-pkg/contrib/strutl.cc
@@ -1000,6 +1000,24 @@ bool TokSplitString(char Tok,char *Input,char **List,
return true;
}
/*}}}*/
+// ExplodeString - Split a string up into a vector /*{{{*/
+// ---------------------------------------------------------------------
+/* This can be used to split a given string up into a vector, so the
+ propose is the same as in the method above and this one is a bit slower
+ also, but the advantage is that we an iteratable vector */
+vector<string> ExplodeString(string const &haystack, char const &split)
+{
+ string::const_iterator start = haystack.begin();
+ string::const_iterator end = start;
+ vector<string> exploded;
+ do {
+ for (; end != haystack.end() && *end != split; ++end);
+ exploded.push_back(string(start, end));
+ start = end + 1;
+ } while (end != haystack.end() && (++end) != haystack.end());
+ return exploded;
+}
+ /*}}}*/
// RegexChoice - Simple regex list/list matcher /*{{{*/
// ---------------------------------------------------------------------
/* */