Results 1 to 3 of 3

Thread: [RESOLVED] How to get the next indexof?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Apr 2010
    Posts
    131

    Resolved [RESOLVED] How to get the next indexof?

    I'm just extracting some very small text from a bigger text file. So, suppose I'm getting a dl link from a "
    Code:
    dl link here
    " tag, there are multiple download links and the way i'm 'extracting' the download link from there uses the indexof method. There are multiple download links, so how would I get the next indexof? Any more details needed tell me.

  2. #2
    PowerPoster
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,070

    Re: How to get the next indexof?

    I'm pretty sure you can specify a start index to IndexOf to indicate from where it should start looking. Use the index of the last find (+ 1 probably) as that start index.

    A much easier method is to use regular expressions though. I am assuming you actually meant [code][/code] tags? That is a very easy match and any regex example should be able to show you how to get it.

  3. #3
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,464

    Re: How to get the next indexof?

    indexof has an overload where you can specify the startIndex:

    vb Code:
    1. Dim teststr As String = "testtesttest"
    2. Dim startAt As Integer = 0
    3. Do While teststr.IndexOf("test", startAt) <> -1
    4.     MsgBox(teststr.IndexOf("test", startAt))
    5.     startAt = teststr.IndexOf("test", startAt) + 4
    6. Loop

Posting Permissions

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



Click Here to Expand Forum to Full Width