If you really want strtok for strings you could roll your own, and I don't think it would be any slower than strtok necessarily, since you would have to do things like make a copy of the string, anyway.
Code:
#include <string>
#include <algorithm>
using namespace std;
// PRE: haystack.end() > last >= haystack.begin()
string myStrtok (string& haystack, const string& needle, string::iterator& last)
{
string result;
string::iterator start = last;
last = find_end(last, haystack.end(), needle.begin(), needle.end());
if(last != haystack.end()) {
copy(start, last, result.begin());
++last;
}
return result;
}
I didn't try it, but it would be something like that.