×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Regular Contributor
    Join Date
    Jan 2006
    Posts
    174

    Unhappy how to find a substring from a specific position?

    For example
    stringA = "abcd123kdlskdk123dkkdkk123"
    stringB = "123"

    I want to find all index of stringB in stringA. I don't want to save a copy of stringA, after finding one occurance of stringB, then delete the head.

    Is there an API in TDes like
    TDes::Find(aSubString, TUInt aStartPos)?

    I dont find available API in SDK.

  2. #2
    Registered User
    Join Date
    Apr 2005
    Location
    Barcelona
    Posts
    1,678

    Re: how to find a substring from a specific position?

    You named it. You have either Find() and Locate() in the descriptor (TDesC) classes, which returns the index of the substring, or KErrNotFound.

  3. #3
    Regular Contributor
    Join Date
    Jan 2006
    Posts
    174

    Question Re: how to find a substring from a specific position?

    Quote Originally Posted by PushL
    You named it. You have either Find() and Locate() in the descriptor (TDesC) classes, which returns the index of the substring, or KErrNotFound.

    What do you mean by "You named it"?

    I can use find() to find a substring ,but it always start from the beginning,How can I find from a specific position?

  4. #4
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,166

    Re: how to find a substring from a specific position?

    maybe you could use something like:

    TInt Nextpos = stringA.Right(stringA.Length()-Latpos).Find(stringB);

    just add the start of the search (Latpos) into the returned value if it is not KErrNotFound and you should have the next found substring location there.

    yucca

Similar Threads

  1. list box example
    By murmur20 in forum Symbian User Interface
    Replies: 1
    Last Post: 2004-11-09, 04:42
  2. placing control on specific position on form
    By anish.agarwal in forum Symbian User Interface
    Replies: 2
    Last Post: 2004-08-16, 08:52
  3. Replies: 4
    Last Post: 2004-03-22, 08:50
  4. Replies: 5
    Last Post: 2004-03-17, 08:40
  5. Device Specific Capabilities - How to Find?
    By tkinsman in forum General Development Questions
    Replies: 0
    Last Post: 2004-01-21, 20:33

Posting Permissions

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