×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Regular Contributor
    Join Date
    Dec 2004
    Posts
    101

    Why This Code never work

    I am trying to find White Spaces in a UNICODE txt file.

    Code:
    void MyApp::FindWhiteSpaces(const TDesC& aString)
    {
    TBuf<100>buf;
    TBuf8<1> chr;
    TInt len = aString.Length();
    for (TInt i=0; i < len  ; i++)
    {
    TPtrC sub = aString.Mid( i ,1);
    chr.Copy(sub);
        if (chr.Compare((_L8(" ")))== 0 )     // This never work
           {
               ....... do something
            }
    }

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,694

    Re: Why This Code never work

    It should work. Though
    Code:
    for (TInt i=0; i < len  ; i++)
    {
       if (aString[i]==' ')
    would be simpler, and there is even aString.Locate(' ')

Similar Threads

  1. Why this python code hangs?
    By ra.ravi.rav in forum Symbian
    Replies: 4
    Last Post: 2012-06-05, 07:32
  2. why does this simple code doesn't work
    By wenn32 in forum Mobile Java General
    Replies: 2
    Last Post: 2011-02-08, 14:43
  3. why doesn't this gps code work?
    By nick_santa83 in forum Symbian
    Replies: 0
    Last Post: 2007-12-09, 19:03
  4. Why doesn't this GetContact call work!
    By acomber in forum PC Suite API and PC Connectivity SDK
    Replies: 3
    Last Post: 2007-10-08, 22:41
  5. Why does this app not work?
    By jensesaat in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 3
    Last Post: 2006-06-05, 21:30

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×