to split a string by detecting a character and displaying the seperated parts

Login to reply to this topic.
Tue, 2008-03-04 20:51
Joined: 2007-09-19
Forum posts: 18

Hi,

I have string Hello.Buddy.abc.def. and i want to display
the substrings seperated by '.' i.e., i want to display
Hello then Buddy then abc and then def..

The code that i tried:

HBufC* Buf= HBufC::NewLC(30);
TPtr Pointer = Buf->Des();
_LIT(KNew, "Hello.Buddy.abc.def");
Pointer.Copy(KNew);
TPtr Ptr1 = Buf->Des();
TLex aLex(Ptr1);
while(aLex.Peek() != '.') aLex.Inc();
aLex.Mark();
while(aLex.Peek() != '.') aLex.Inc();

TPtrC aPtr = aLex.MarkedToken();
aLex.Mark();
CAknInformationNote* note = new ( ELeave ) CAknInformationNote;
note->ExecuteLD(aPtr);

I am displaying only one part of it seperated by '.' but still
it is giving a panic..

Plz help...

  • Login to reply to this topic.