×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Regular Contributor
    Join Date
    Oct 2008
    Posts
    95

    DELETE BACKSLASH

    HI.
    I WANT TO DELETE BACKSLASH FROM THE CONTENT I M GETTING IN A BUFFER ..
    BUT WHEN I SEARCH FOR THE BACKSLASH BY COPYING IT AS A LITERAL..IT DOESNT WORK..

    IS THERE ANY WAY I CAN DELETE IT FROM THE BUFFER.

  2. #2
    Nokia Developer Champion
    Join Date
    Jan 2008
    Location
    Moscow, Russia
    Posts
    3,348

    Re: DELETE BACKSLASH

    Show your code.
    ---
    For example:
    Code:
    _LIT(KText,"Hello World!");
    ...
    TBufC<16> buf1(KText); // length is 12 
    ...
    buf1.Delete(6,6); // length is now 6, leaving "Hello" in the buffer

  3. #3
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,673

    Re: DELETE BACKSLASH

    Indeed, it is hard to suggest anything, even if you are writing in all upper-case. Generally TDesC::Find/Locate can help you in finding - I would suggest Locate, since it works with a single character, which is most probably results in faster operation -, and TDes:elete can remove a part of the descriptor.
    And remember that backslash is an escape character, so if you need it, you have to type it twice.

  4. #4
    Regular Contributor
    Join Date
    Oct 2008
    Posts
    95

    Re: DELETE BACKSLASH

    hi.


    i have tried what u said..

    TInt var9= iAppUi->buf1.Find(_L("\\")); // var9 is -1

    TInt var8 =iAppUi->buf1.Find(_L("/")); // var8 is zero


    i think it means it is unable to find backslash

  5. #5
    Nokia Developer Champion
    Join Date
    Jan 2008
    Location
    Moscow, Russia
    Posts
    3,348

    Re: DELETE BACKSLASH

    I've check this and it's work fine:

    Code:
    TInt var9 = buf1.Locate('\\');
    buf1.Delete( var9, 1 ); // delete a single backslash

  6. #6
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,673

    Re: DELETE BACKSLASH

    Quote Originally Posted by neel.soft View Post
    TInt var9= iAppUi->buf1.Find(_L("\\")); // var9 is -1

    TInt var8 =iAppUi->buf1.Find(_L("/")); // var8 is zero


    i think it means it is unable to find backslash
    There is no backslash, that is what it means...
    And the other one means that buf1 starts with a slash.

    A.A.M.: your code obviously dies with USER 10 in neel.soft's case.

  7. #7
    Nokia Developer Champion
    Join Date
    Jan 2008
    Location
    Moscow, Russia
    Posts
    3,348

    Re: DELETE BACKSLASH

    Quote Originally Posted by wizard_hu_ View Post
    A.A.M.: your code obviously dies with USER 10 in neel.soft's case.
    USER 10: "This panic is raised when the position value passed to a 16-bit variant descriptor member function is out of bounds. It may be raised by the Left(), Right(), Mid(), Insert(), Delete() and Replace() member functions of TDes16."
    Thx, fixed
    Code:
    TInt var9 = buf1.Locate('\\');
    if (var9>=0)
      buf1.Delete(var9,1); // delete a single backslash

Similar Threads

  1. Delete function help
    By 1symbian1 in forum Symbian
    Replies: 30
    Last Post: 2008-10-30, 19:50
  2. Delete operator of a custom memory allocator
    By cflaviu in forum Symbian
    Replies: 3
    Last Post: 2008-03-26, 13:49
  3. crash for overloaded delete operator
    By mihirg in forum Symbian
    Replies: 2
    Last Post: 2007-10-09, 12:08
  4. can not successfully link any sample using .NET
    By lobotomat in forum Symbian Tools & SDKs
    Replies: 2
    Last Post: 2002-08-20, 00:29
  5. Creating and Delete databases
    By -kevbo- in forum Symbian
    Replies: 1
    Last Post: 2001-12-13, 12:54

Posting Permissions

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