Updated 2014-06-07 17:16:37 by dkf

This command, a part of tclx is documented thusly within the package:
ctoken strvar separators

Parse a token out of a character string. The string to parse is contained in the variable named strvar. The string separators contains all of the valid separator characters for tokens in the string. All leading separators are skipped and the first token is returned. The variable strvar will be modified to contain the remainder of the string following the token.

This command does not work with binary data.

Compare with split and note that they are not equivalent.

Can anyone provide me an example of how this works?

PL 2003-08-02:
 50 % set s abc-def=ghi/jkl:mno(pqr)stu&[email protected]
 abc-def=ghi/jkl:mno(pqr)stu&[email protected]
 51 % set sep -:()@
 -:()@
 52 % ctoken s $sep
 abc
 53 % set s
 -def=ghi/jkl:mno(pqr)stu&[email protected]
 54 % ctoken s $sep
 def=ghi/jkl
 55 % set s
 :mno(pqr)stu&[email protected]
 56 % ctoken s $sep
 mno
 57 % set s
 (pqr)stu&[email protected]
 58 % ctoken s $sep
 pqr
 59 % set s
 )stu&[email protected]
 60 % ctoken s $sep
 stu&vwx
 61 % set s
 @yz
 62 % ctoken s $sep
 yz
 63 % set s
 64 % ctoken s $sep