+ 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 ' '

18th Jul 2017, 5:57 PM
StillSoul‌‌‌‌‌‌‌‌‌‌‌‌‌‍
StillSoul‌‌‌‌‌‌‌‌‌‌‌‌‌‍ - avatar
2 ответов
+ 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! :)
19th Jul 2017, 12:46 AM
Zeke Williams
Zeke Williams - avatar
+ 3
Thanks ^w^
19th Jul 2017, 6:00 PM
StillSoul‌‌‌‌‌‌‌‌‌‌‌‌‌‍
StillSoul‌‌‌‌‌‌‌‌‌‌‌‌‌‍ - avatar