- add better syntax of split() method
This commit is contained in:
parent
2b0b74f084
commit
fca9395193
|
|
@ -199,6 +199,13 @@ void StringHelper::split(const std::string& src, std::vector<std::string>& dst,
|
|||
}
|
||||
}
|
||||
|
||||
std::vector<std::string> StringHelper::split(const std::string& src, const std::string& delims)
|
||||
{
|
||||
std::vector<std::string> r;
|
||||
split(src, r, delims);
|
||||
return r;
|
||||
}
|
||||
|
||||
std::pair<std::string, int> StringHelper::parseHost(const std::string& host, int defaultPort)
|
||||
{
|
||||
std::pair<std::string, int> result;
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ public:
|
|||
|
||||
static const char* findSubstring(const char* buffer, const char* substring, size_t bufferLength);
|
||||
static void split(const std::string& src, std::vector<std::string>& dst, const std::string& delims);
|
||||
static std::vector<std::string> split(const std::string& src, const std::string& delims = "\n");
|
||||
|
||||
template <typename T>
|
||||
static std::string join(const std::vector<T>& v, const std::string& delimiter)
|
||||
|
|
|
|||
Loading…
Reference in New Issue