0
コマンドラインの文字列を解析しようとしていますが、文字列に引用符で囲んだ文字列を考慮して空白を入れてみます。私は2つの引用符の間にあるものをベクトルの1つのインデックスとして保存したい。引用符の間の引数を考慮に入れる
vector<string> words;
stringstream ss(userInput);
string currentWord;
vector<string> startWith;
stringstream sw(userInput);
while (getline(sw, currentWord, ' '))
words.push_back(currentWord);
while (getline(ss, currentWord, '"'))
startWith.push_back(currentWord); //if(currentWord.compare("")){ continue;}
for (int i = 0; i < startWith.size(); i++)
curr
if(currentWord.compare("")){ continue;}
cout << " Index "<< i << ": " << startWith[i] << "\n";
[STD ::引用されたが(http://en.cppreference.com/w/cpp/io/manip /引用) – ZDF
@ZDFこれはC++ 11以降、C++ 14以降では利用できません。 – Murphy
@Murphy Correct。 – ZDF