0

I have string that I would like cut to substrings according 0x1d cahr delimiter. How to tell istringstream that it must extract chars dosed according 0x1d delimiter during >> operation?

string s("Somewhere"+string(1,0x1d)+"down"+string(1,0x1d)+"the"+string(1,0x1d)+"road");

istringstream iss(s);

do
{
    string sub;

    iss >> sub;
    cout << "Substring: " << sub << endl;
} while (iss);
Orelsanpls
  • 20,654
  • 4
  • 36
  • 61
vico
  • 15,367
  • 39
  • 141
  • 262

1 Answers1

0

You get your respond Here

From @jrok

std::string input = "abc,def,ghi";
std::istringstream ss(input);
std::string token;

while(std::getline(ss, token, ',')) {
    std::cout << token << '\n';
}
Community
  • 1
  • 1
Orelsanpls
  • 20,654
  • 4
  • 36
  • 61