SHARE
TWEET

Untitled




Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- std::vector<std::string> split(const std::string& s, char delimiter = ';'){
- std::vector<std::string> result;
- std::string tmp = s;
- while(tmp.find(delimiter) != std::string::npos)
- {
- std::string new_part = tmp.substr(0, tmp.find(delimiter));
- tmp = tmp.substr(tmp.find(delimiter)+1, tmp.size());
- if(not (new_part.empty()))
- {
- if(new_part.front()='"' && new_part.back()='"'){
- result.push_back(new_part.substr(1, new_part.size()-2));
- }
- else{
- result.push_back(new_part);
- }
- }
- }
- if(not tmp.empty())
- {
- if(tmp.front()='"' && tmp.back()='"'){
- result.push_back(tmp.substr(1, tmp.size()-2));
- }
- else{
- result.push_back(tmp);
- }
- }
- return result;
- }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.