Is there a way to tokenize a string in C++ with multiple separators? In C# I would have done:
string[] tokens = "adsl, dkks; dk".Split(new [] { ",", " ", ";" }, StringSplitOptions.RemoveEmpty);
Is there a way to tokenize a string in C++ with multiple separators? In C# I would have done:
string[] tokens = "adsl, dkks; dk".Split(new [] { ",", " ", ";" }, StringSplitOptions.RemoveEmpty);
Here is my version (not heavily tested (yet)):
Use boost::tokenizer. It supports multiple separators.
In fact, you don't really even need boost::tokenizer. If all you want is a split, use boost::split. The documentation has an example: http://www.boost.org/doc/libs/1_42_0/doc/html/string_algo/usage.html#id1718906
Something like that will do: