+ 3
Can multiple Delimiters be used in C++ ?
Can we use multiple delimiters while reading a file using get() or getline()? Say I want to store words ending with both '.' and ' '
2 Answers
+ 1
"No, std::getline() only accepts a single character, to override the default delimiter. std::getline() does not have an option for multiple alternate delimiters.
The correct way to parse this kind of input is to use the default std::getline() to read the entire line into a std::string, then construct a std::istringstream, and then parse it further, into comma-separate values." - some dude on stack overflow
Hope this helps! :)
+ 3
Thanks ^w^