文字列内の最初のトークンを出力

strtok

token = strtok(‘str’,delimiter);

s = ‘This is a book, which I gave you.’;
[token1,rem1] = strtok(s,’,’);
token1 = This is a book
[token2,rem2] = strtok(s,’.’);
token2 = This is a book, which I gave you

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s