[Tutor] what is the equivalent function to strtok() in c++

Kent Johnson kent37 at tds.net
Mon Jan 11 12:46:15 CET 2010


On Mon, Jan 11, 2010 at 2:33 AM, sudhir prasad <sudheer.kay at gmail.com> wrote:
> hi,
> what is the equivalent function to strtok() in c++,
> what i need to do is to divide a line into different strings and store them
> in different lists,and write them in to another file

To split on a single character or a fixed sequence of characters use
str.split(). To split on any one of a collection of characters use
re.split().

Note that if you pass multiple characters to str.split(), the string
is split on occurrences of the multiple character string, not on
occurrences of any character in the string. So for multiple character
arguments, str.split() is not equivalent to strtok().

Kent


More information about the Tutor mailing list