Skip to content

Instantly share code, notes, and snippets.

@elowy01
Created November 12, 2019 16:49
Show Gist options
  • Save elowy01/c882962039ee28193c88327e7146dc91 to your computer and use it in GitHub Desktop.
Save elowy01/c882962039ee28193c88327e7146dc91 to your computer and use it in GitHub Desktop.
#include <string>
#include <boost/algorithm/string.hpp>
using namespace std;
int main()
{
//split tab-separated string into vector of strs
string line("test\ttest2\ttest3");
vector<string> strs;
boost::split(strs,line,boost::is_any_of("\t"));
//Now, concatenate this vector of strings into string
std::string joinedString = boost::algorithm::join(strs, "\t");
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment