I think I need a reverse version of strtok, like:
char* p = rstrtok(str, delimeters);
For example, sequentially get the position of '-'
, '_'
and '+'
in the string "hello+stack_over-flow" using a delimeter set of "+_-"
I only care about the delimeters, and their position, (not the content between), so I guess the boost::split_iterator
is not appropriate here.
Is there any existing utility function I can leverage? or any solution to deal with this kind of situation?
Furthermore, since I am doing C++, is there any convenient approach to avoid this old fashion C?
(I searched "reverse strtok" but merely get "stack over flow" to "flow over stack" stuff...)