mirror of https://github.com/kiwix/libkiwix.git
+ move of src files
This commit is contained in:
parent
c9778c9097
commit
0eba48c200
|
@ -0,0 +1,31 @@
|
|||
#include "splitString.h"
|
||||
|
||||
std::vector<std::string> split(const std::string & str,
|
||||
const std::string & delims=" *-")
|
||||
{
|
||||
string::size_type lastPos = str.find_first_not_of(delims, 0);
|
||||
string::size_type pos = str.find_first_of(delims, lastPos);
|
||||
vector<string> tokens;
|
||||
|
||||
while (string::npos != pos || string::npos != lastPos)
|
||||
{
|
||||
tokens.push_back(str.substr(lastPos, pos - lastPos));
|
||||
lastPos = str.find_first_not_of(delims, pos);
|
||||
pos = str.find_first_of(delims, lastPos);
|
||||
}
|
||||
|
||||
return tokens;
|
||||
}
|
||||
|
||||
std::vector<std::string> split(const char* lhs, const char* rhs){
|
||||
const std::string m1 (lhs), m2 (rhs);
|
||||
return split(m1, m2);
|
||||
}
|
||||
|
||||
std::vector<std::string> split(const char* lhs, const std::string& rhs){
|
||||
return split(lhs, rhs.c_str());
|
||||
}
|
||||
|
||||
std::vector<std::string> split(const std::string& lhs, const char* rhs){
|
||||
return split(lhs.c_str(), rhs);
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
using namespace std;
|
||||
|
||||
std::vector<std::string> split(const std::string&, const std::string&);
|
||||
std::vector<std::string> split(const char*, const char*);
|
||||
std::vector<std::string> split(const std::string&, const char*);
|
||||
std::vector<std::string> split(const char*, std::string&);
|
Loading…
Reference in New Issue