I was wondering if there is a way to read all the “words” from a line of text.
the line will look like this: R, 4567890, Dwyer, Barb, CSCE 423, CSCE 486
Is there a way to use a comma as a separator to parse this string in an array, or something like that?
Yes, use std::getlinestringstreams too.
std::getline
std::string str = "R,4567890,Dwyer,Barb,CSCE 423,CSCE 486"; std::istringstream iss(str); std::vector<std::string> words; while (std::getline(iss, str, ',')) words.push_back(str);
//#include sstream with angular braces in header files std::string str = "R,4567890,Dwyer,Barb,CSCE 423,CSCE 486"; std::istringstream iss(str,istringstream:in); vector<std::string> words; while (std::getline(iss, str, ',')) words.push_back(str);
Source: https://habr.com/ru/post/1718646/More articles:Поведение привязки WPF ComboBox - data-bindingMSI Log Debug Log Sink - c #How to create and apply standards for user interface development? - standardsHow can caches_action be configured to work in multiple formats? - ajaxМоделирование базы данных или дизайн базы данных: что на первом месте? - dnsкак читать и записывать в последовательный порт (ttys0) с другого компьютера через ethernet (eth0) на Ubuntu/Debian? - linuxpython PIL - the background is displayed opaque, not transparent - pythonHow to list all available Wi-Fi networks using Delphi - networkinghttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1718650/should-i-use-delegate-classes-if-i-want-items-to-be-edited-using-a-dialog-in-qt&usg=ALkJrhhNFE1neXAI1G6ycaSKr_0cvifFhQNSCollectionView in 10.6 / Xcode 3.2 - objective-cAll Articles