substr help

Hello, I am quite new to C++ and I just learn about substr.
I was wondering if it was possible to use a loop to keep finding a substr for spaces in a sentences.

for example:
if my string was string line = "HEY MAN WHAT IS GOING ON?"
how would I go about filling in the parenthesis of line.substr(x,y) so that it can give me all the space in the string?

I'm asking this because I think this is one way I could store each word from the string into a string array that will store them.
Last edited on
std::string::find(). also, if you put it in a string stream then you can just break it up by spaces that way
Topic archived. No new replies allowed.