Istringstream

Read string with a special delimiter

istream& getline (istream& is, string& str, char delim);

By default delim is \n. See morearrow-up-right.

Take 165. Compare Version Numbers (Medium)arrow-up-right for example, we can read the string segment using:

getline(version1, segment, '.')

Detect EOF

iss.eof(); // returns true if it has reached EOF.
iss.good(); // returns true if none of the error state flags (eofbit, failbit and badbit) is set.

Last updated

Was this helpful?