Search
 
SCRIPT & CODE EXAMPLE
 

CPP

cpp iterate words from 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;
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: gestd::getline with wstring 
Cpp :: xmake run with arg 
Cpp :: change int to string cpp 
Cpp :: exit() in c++ 
Cpp :: certificate exe application 
Cpp :: hi cpp 
Cpp :: set precision in c++ 
Cpp :: regex for phone number c++ 
Cpp :: cuda extern __shared__ 
Cpp :: newline in c++ 
Cpp :: C++ Converting Kelvin to Fahrenheit 
Cpp :: xmake set exe name 
Cpp :: number to binary string c++ 
Cpp :: cout char32_t c++ 
Cpp :: c++ virtual function in constructor 
Cpp :: convert string to number c++ 
Cpp :: string to int arduino 
Cpp :: iterate vector from end to begin 
Cpp :: fabs() c++ 
Cpp :: c++ unordered_map check if key exists 
Cpp :: Unsorted Linked list in c++ 
Cpp :: how to read a comma delimited file into an array c++ 
Cpp :: how to split a string into words c++ 
Cpp :: latex double subscript 
Cpp :: iterating in map/unordered map c++ 
Cpp :: for in c++ 
Cpp :: C++ Swap 2 Variables Without Using 3rd Variable 
Cpp :: c++ function for checking if a sting is a number 
Cpp :: string to decimal c++ strtol 
Cpp :: how to get the first element of a map in c++ 
ADD CONTENT
Topic
Content
Source link
Name
4+8 =