I would like to write something in C++ that tokenize a string. To explain what I want, take the following string:
add string "this is a string with spaces!"
this is a string with spaces!
I guess there is no straight forward approach with standard library. Indirectly following algo will work:
a) search for '\"' with
string::find('\"') . If anything found search for next '\"' using
string::find('\'',prevIndex), If found use
string::substr(). Discard that part from the original string.
b) Now Serach for
' ' character in the same way.
NOTE: you have to iterate through the whole string.