Which means, if you'll pardon the C idiom, that you need something like
to get through all the characters of strDelimiter.Code:while ((*p != *strDelimiter) && *(++strDelimiter));
It also appears you're missing the "it doesn't count if it starts that way" rule -- strtok skips all appearances of the delimiter character at the beginning of the string. (You skip one character -- regardless of whether it's a delimiter or not -- with the while p++ thing, but the space is still given in the tokenized version as well.) You can argue that that's the way that you want it, but if you add two spaces to the front of your test string you won't be happy with the results.
ETA: Well, we can't use strDelimiter in that while loop up there, since that was our original. But we can do it with a copy.



LinkBack URL
About LinkBacks



