Add a stringVector join function for future use
This commit is contained in:
parent
4863ce96a3
commit
a88ce80716
|
@ -126,6 +126,17 @@ StringVector split( const std::string &string, const std::string chars, int limi
|
||||||
return( stringVector );
|
return( stringVector );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const std::string join(const StringVector v, const char * delim ) {
|
||||||
|
std::stringstream ss;
|
||||||
|
|
||||||
|
for(size_t i = 0; i < v.size(); ++i) {
|
||||||
|
if(i != 0)
|
||||||
|
ss << ",";
|
||||||
|
ss << v[i];
|
||||||
|
}
|
||||||
|
return ss.str();
|
||||||
|
}
|
||||||
|
|
||||||
const std::string base64Encode( const std::string &inString )
|
const std::string base64Encode( const std::string &inString )
|
||||||
{
|
{
|
||||||
static char base64_table[64] = { '\0' };
|
static char base64_table[64] = { '\0' };
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <sstream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
typedef std::vector<std::string> StringVector;
|
typedef std::vector<std::string> StringVector;
|
||||||
|
@ -36,6 +37,7 @@ const std::string stringtf( const std::string &format, ... );
|
||||||
|
|
||||||
bool startsWith( const std::string &haystack, const std::string &needle );
|
bool startsWith( const std::string &haystack, const std::string &needle );
|
||||||
StringVector split( const std::string &string, const std::string chars, int limit=0 );
|
StringVector split( const std::string &string, const std::string chars, int limit=0 );
|
||||||
|
const std::string join( const StringVector, const char * );
|
||||||
|
|
||||||
const std::string base64Encode( const std::string &inString );
|
const std::string base64Encode( const std::string &inString );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue