Bill the Lizard Bill the Lizard - 1 year ago 116
C++ Question

How do I tokenize a string in C++?

Java has a convenient split method:

String str = "The quick brown fox";
String[] results = str.split(" ");

Is there an easy way to do this in C++?

Answer Source

Your simple case can easily be built using the std::string::find method. However, take a look at Boost.Tokenizer. It's great. Boost generally has some very cool string tools.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download