Join Now
Quality Rating:
  • Currently 5.0 / 5
(5.0 / 5 - 1 vote cast)
Expertise Level:
  • Currently 5.0 / 5
(5.0 / 5 - 1 vote cast)

This page was last modified 14:17, 19 March 2008.

How to define a custom separator in TLex

From Forum Nokia Wiki

TLex does not provide support for user defined separators, hence a possible workaround could be using the MarkedToken(), Mark(), Get(), and Peek() methods for achieving the desired results.

// 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 Link

Related Discussions
Thread Thread Starter Forum Replies Last Post
Scheduled Alerts / Custom Calendar Notes darkenvy General Symbian C++ 1 2003-09-24 15:30
custom textfiled? dakoz Mobile Java General 6 2006-05-02 14:14
string -> hex -> ascii manmli General Symbian C++ 5 2005-05-02 22:12
creating selection listbox in multipage dialog meetee Symbian User Interface 10 2006-08-04 16:15
sprintf floating point format bug apilotti General Symbian C++ 2 2007-10-30 01:44
 
Powered by MediaWiki
     
     RDF Facets:
     
     
     qfnZtypeQUqfnTypeZCommunityContentQ
     qfnZtypeQUqfnTypeZWebpageQ
     qfnZtypeQUqfnTypeZWikiContentQ
     qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX