Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

cpp iterate words of string

#include <iostream>
#include <sstream>

std::string input = "This is a sentence to read";
std::istringstream ss(input);
std::string token;

while(std::getline(ss, token, ' ')) {
    std::cout << token << endl;
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #cpp #iterate #words #string
ADD COMMENT
Topic
Name
3+7 =