Saturday, August 11, 2007

How to use TLex to Parse tokens from String.

  _LIT8(KSomeConstString,"first,second,third,fourth");

TLex8 lex(KSomeConstString);
TChar ch;
TBuf8<50> token;

while((ch = lex.Get()) != 0 )
{
while ((ch = lex.Peek()) != ',')
lex.Inc();

token.Copy(lex.MarkedToken());
/*
Now we have the string in token,
do something..
*/
lex.Inc();
lex.Mark();
}

No comments:

stats counter