}

C++-faq Index Page 1

How to Split a string in C++?

In this tutorial we are going to show how to split a string separated by spaces. We will use istringstream and copy functions to save the result in a vector with the tokens. Our last example code will split the string with any delimiter using c++ and the standard library.