forked from mirrors/linphone-iphone
Add utility method to join a vector of strings into a single string.
This commit is contained in:
parent
9c80965f1e
commit
f4f642a4d5
1 changed files with 10 additions and 0 deletions
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
#include <ctime>
|
||||
#include <list>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
|
@ -107,6 +108,15 @@ namespace Utils {
|
|||
return str ? str : "";
|
||||
}
|
||||
|
||||
template<typename S, typename T>
|
||||
LINPHONE_PUBLIC std::string join (const std::vector<T>& elems, const S& delim) {
|
||||
std::stringstream ss;
|
||||
auto e = elems.begin();
|
||||
ss << *e++;
|
||||
for (; e != elems.end(); ++e)
|
||||
ss << delim << *e;
|
||||
return ss.str();
|
||||
}
|
||||
LINPHONE_PUBLIC std::string trim (const std::string &str);
|
||||
|
||||
template<typename T>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue