Split a string into words by multiple delimiters in C?

Assuming one of the delimiters is newline, the following reads the line and further splits it by the delimiters. For this example I've chosen the delimiters space, apostrophe, and semi-colon std::stringstream stringStream(inputString); std::string line; while(std::getline(stringStream, line)) { std::size_t prev = 0, pos; while ((pos = line. Find_first_of(" ';", prev))!

= std::string::npos) { if (pos > prev) wordVector. Push_back(line. Substr(prev, pos-prev)); prev = pos+1; } if (prev Push_back(line.

Substr(prev, std::string::npos)); }.

Assuming one of the delimiters is newline, the following reads the line and further splits it by the delimiters. For this example I've chosen the delimiters space, apostrophe, and semi-colon. Std::stringstream stringStream(inputString); std::string line; while(std::getline(stringStream, line)) { std::size_t prev = 0, pos; while ((pos = line.

Find_first_of(" ';", prev))! = std::string::npos) { if (pos > prev) wordVector. Push_back(line.

Substr(prev, pos-prev)); prev = pos+1; } if (prev.

1 You're too fast for me :p If newline is not a delimiter, then simply picking one of the "regular" delimiters (and removing it from the inner loop) will work. – Matthieu M. Oct 1 at 17:32 Awesome!

Thanks a lot! – Ypsilon IV Oct 1 at 18:27.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions