I am using Boost Tokenizer to remove formatted coordinates, eg (x,y). However, it is adding an additional space after the removal. There are no spaces, but I can't figure out how to get rid of this.
while (std::getline(input, line)) {
boost::char_separator<char> sep("(),");
typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
tokenizer tok(line, sep);
for (auto &i : tok) {
_edges.push_back(i);
}
}
In the vector, the result is the following:
[x][y][space]
"I can't figure out how to get rid of this."
Once you have fetched a line of text from the file, but before you start parsing the tokens, you can use
boost::trim()
to remove any leading and trailing whitespace from the fetched line: