Namespaces
Variants
Actions

Getting tokens

Jump to: navigation, search
Article Metadata

Article
Created: kiran10182 (07 May 2007)
Last edited: hamishwillee (23 Jul 2012)

Following code snippet illustrate how to extract tokens from the available data.

    CDesC16Array *array= new (ELeave) CDesC16ArrayFlat(10);
_LIT(KData,"This is the token example." \
"You will get different tokens in array.");
TLex lex(KData);
 
do
{
TPtrC token = lex.NextToken();
if(token.Length() == 0)
break;
array->AppendL(token);
} while(1);

Note: This is just an example which extract tokens from string defined using LIT macro. However you can use this code in general terms. You can extract tokens from descriptors, file data etc. Here Array granularity is taken as 10. You can use granularity on your application's discretion.

This page was last modified on 23 July 2012, at 10:39.
83 page views in the last 30 days.
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved