for example i have a string:
string s = "apple | orange | kiwi";
and i searched and there is a way:
stringstream stream(s);
string tok;
getline(stream, tok, '|');
but it only can return the first token "apple"
I wonder that is there any way so it can return an array of string?
Thank you.
Let assume that the string s may be changed. For exammple, string s = "apple | orange | kiwi | berry";
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…