You Are Here:

Community: Wiki

This page was last modified on 27 October 2009, at 07:16.

如何在TLex中自定义分隔符

From Forum Nokia Wiki

TLex 不提供用户定义分隔符,因此我们可以采用可选方案:MarkedToken(), Mark(), Get(), 和Peek()方法,获得我们需要的结果。

// As an example taking "," as a separator.
_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 as the token,
* do something.. */

 
lex.Inc();
lex.Mark();
}

相关链接

Related Wiki Articles

No related wiki articles found

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia