strtok

Purpose

First token in string.

Synopsis

token = strtok('str',del)
token = strtok('str')
[token,rem] = strtok('str',del)

Description

token = strtok('str',del) returns the first token in the text string str, that is, the first set of characters before a delimiter is encountered. del is a vector containing valid delimiter characters.

token = strtok('str') uses the default delimiter, a white space.

[token,rem] = strtok('str',del) returns the remainder rem of the original string. The remainder consists of all characters from the first delimiter on.

Examples

s = 'This is a good example.';
[token,rem] = strtok(s)
          
token =
This
          
rem =
 is a good example.

See Also

isspace

(c) Copyright 1994 by The MathWorks, Inc.