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