Navigation

Operators and Keywords

Function List:

C++ API

strtok.m File Reference


Functions

endif if (nargin< 2||isempty(delim)) delim
endif if (isempty(str)) tok
 elseif (length(delim) > 3) start
 while (start<=len) if(all(str(start)!
 while (stop<=len) if(any(str(stop)
else if (length(delim)==1) idx
 elseif (length(delim)==2) idx
endif if (isempty(idx)) tok
 if (isempty(skip)) tok
endif endif endif endfunction!demo !strtok ("this is the life")%!%split at the first space
 !printf ("<%s>", t)
!if isempty (s)
endif !printf ("<%s>", s(1))
!endwhile !printf ("\n")
id is: (strtok(""assert)
 !assert (strtok("this"),"this")
 !assert (strtok("this "),"this")
 !assert (strtok("this is"),"this")
 !assert (strtok(" this"),"this")
 !assert (strtok(" this "),"this")
 !assert (strtok(" "),""(1:0))
 assert (r,"")
 assert (r, char(zeros(1, 0)))
 assert (r," ")
 assert (r," is")
 !assert (strtok("this is","i "),"th")
 !assert (strtok("this is","ij "),"th")
 !assert (strtok("","jkl "),"")
 !assert (strtok("this","jkl "),"this")
 !assert (strtok("this ","jkl "),"this")
 !assert (strtok("this is","jkl "),"this")
 !assert (strtok(" this","jkl "),"this")
 !assert (strtok(" this ","jkl "),"this")
 !assert (strtok(" ","jkl "),""(1:0))
 !assert (strtok(" this "'),"this"')
 !assert (strtok(" this "',"jkl "),"this"')
 !assert (t,"beg")

Variables

 function [tok, rem]
 len = length (str)
endwhile stop = start
endwhile tok = str(start:stop-1)
 rem = str(stop:len)
else idx = find (str == delim(1) | str == delim(2) | str == delim(3))
else skip = find (idx(:)' != 1:length(idx))
endif endif endif
endfunction!demo returning
this!demo 
!s
!if break
 !test [t, r] = strtok("")
!test!for ch

Function Documentation

!assert ( ,
"beg"   
)

!assert ( strtok(" this "',"jkl ")  ,
"this"'   
)

!assert ( strtok(" this "')  ,
"this"'   
)

!assert ( strtok(" ","jkl ")  ,
""  1:0 
)

!assert ( strtok(" this ","jkl ")  ,
"this"   
)

!assert ( strtok(" this","jkl ")  ,
"this"   
)

!assert ( strtok("this is","jkl ")  ,
"this"   
)

!assert ( strtok("this ","jkl ")  ,
"this"   
)

!assert ( strtok("this","jkl ")  ,
"this"   
)

!assert ( strtok("","jkl ")  ,
""   
)

!assert ( strtok("this is","ij ")  ,
"th"   
)

!assert ( strtok("this is","i ")  ,
"th"   
)

!assert ( strtok(" ")  ,
""  1:0 
)

!assert ( strtok(" this ")  ,
"this"   
)

!assert ( strtok(" this")  ,
"this"   
)

!assert ( strtok("this is")  ,
"this"   
)

!assert ( strtok("this ")  ,
"this"   
)

!assert ( strtok("this")  ,
"this"   
)

! endwhile !printf ( "\n"   ) 

endif !printf ( "<%s>"  ,
s(1)   
)

!printf ( "<%s>"  ,
 
)

endif endif endif endfunction !demo !strtok ( "this is the life"   ) 

assert ( ,
" is"   
)

assert ( ,
" "   
)

assert ( ,
char(zeros(1, 0))   
)

assert ( ,
""   
)

elseif ( length(delim = =2  ) 

elseif ( length(delim ,
 
)

if ( isempty(skip  ) 

endif if ( isempty(idx)   ) 

else if ( length(delim = =1  ) 

endif if ( isempty(str)   ) 

endif if (  ) 

id is: (  )  [virtual]

! if isempty (  ) 

while ( stop<=  len  ) 

while ( start<=  len  ) 


Variable Documentation

endif endif endif endfunction !demo returning this !demo !s

Initial value:

 "14*27+31"
%! while 1
%!   [t,s] = strtok(s, "+-*/")

!test[t, r] = strtok("")

! if break

!test ! for ch

Initial value:

 "\t\n\v\f\r"
%!   [t, r] = strtok (cstrcat ("beg", ch, "end"))

Initial value:

 strtok (str, delim)

  if (nargin<1 || nargin > 2)
    print_usage ()

else idx = find (str == delim(1) | str == delim(2) | str == delim(3))

len = length (str)

rem = str(stop:len)

else skip = find (idx(:)' != 1:length(idx))

else tok = str(start:stop-1)