#include
#include
#include
int main(){
std::string s("Somewhere down the road");
std::istringstream iss(s);
do{
std::string sub;
iss >> sub;
std::cout << "Substring: " << sub << std::endl;
} while (iss);
}
#include
#include
#include
#include
#include
int main() {
using namespace std;
string sentence = "And I feel fine...";
istringstream iss(sentence);
copy(istream_iterator(iss),
istream_iterator(),
ostream_iterator(cout, "
"));
}
#include
#include
#include
void split(const std::string &s, char delim, std::vector &elems) {
std::stringstream ss;
ss.str(s);
std::string item;
while (std::getline(ss, item, delim)) {
elems.push_back(item);
}
}
std::vector split(const std::string &s, char delim) {
std::vector elems;
split(s, delim, elems);
return elems;
}