summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib/strutl.cc
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg/contrib/strutl.cc')
-rw-r--r--apt-pkg/contrib/strutl.cc18
1 files changed, 15 insertions, 3 deletions
diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc
index cf8feb970..88113f7a4 100644
--- a/apt-pkg/contrib/strutl.cc
+++ b/apt-pkg/contrib/strutl.cc
@@ -27,6 +27,7 @@
#include <locale>
#include <sstream>
#include <string>
+#include <sstream>
#include <vector>
#include <stddef.h>
@@ -85,6 +86,17 @@ bool Startswith(const std::string &s, const std::string &start)
return (s.compare(0, start.size(), start) == 0);
}
+std::string Join(std::vector<std::string> list, const std::string &sep)
+{
+ std::ostringstream oss;
+ for (auto it = list.begin(); it != list.end(); it++)
+ {
+ if (it != list.begin()) oss << sep;
+ oss << *it;
+ }
+ return oss.str();
+}
+
}
}
/*}}}*/
@@ -748,7 +760,7 @@ int StringToBool(const string &Text,int Default)
// TimeRFC1123 - Convert a time_t into RFC1123 format /*{{{*/
// ---------------------------------------------------------------------
/* This converts a time_t into a string time representation that is
- year 2000 complient and timezone neutral */
+ year 2000 compliant and timezone neutral */
string TimeRFC1123(time_t Date)
{
return TimeRFC1123(Date, false);
@@ -1466,7 +1478,7 @@ string StripEpoch(const string &VerStr)
// tolower_ascii - tolower() function that ignores the locale /*{{{*/
// ---------------------------------------------------------------------
/* This little function is the most called method we have and tries
- therefore to do the absolut minimum - and is notable faster than
+ therefore to do the absolute minimum - and is notable faster than
standard tolower/toupper and as a bonus avoids problems with different
locales - we only operate on ascii chars anyway. */
#undef tolower_ascii
@@ -1480,7 +1492,7 @@ int tolower_ascii(int const c)
// isspace_ascii - isspace() function that ignores the locale /*{{{*/
// ---------------------------------------------------------------------
/* This little function is one of the most called methods we have and tries
- therefore to do the absolut minimum - and is notable faster than
+ therefore to do the absolute minimum - and is notable faster than
standard isspace() and as a bonus avoids problems with different
locales - we only operate on ascii chars anyway. */
#undef isspace_ascii