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
  • 22,456
  • 6
  • 42
  • 69
vico
  • 17,051
  • 45
  • 159
  • 315

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
  • 22,456
  • 6
  • 42
  • 69