Results 1 to 2 of 2

Thread: [VB6] Fast GetStringBetween

  1. #1
    Saiyan Race
    j03's Avatar
    Joined
    Dec 2011
    Posts
    13,838
    Userbars
    176
    Thanks
    6,005
    Thanked
    33,755/6,686
    DL/UL
    23/36
    Mentioned
    3,900 times
    Time Online
    569d 16h 26m
    Avg. Time Online
    3h 10m

    [VB6] Fast GetStringBetween

    Fastest? Well I'd like to say it is as some people claim it to be, but anything is possible

    Here it is:

    Code:
    Public Function GetStringBetween(Main As String, start As String, Finish As String, Optional Index As Long = 1) As String
    On Error Resume Next
        GetStringBetween = Split(Split(Main, start, Index + 1)(Index), Finish, 2)(0)
    End Function
    An example of using this to grab NP on hand would be:

    lblNP.Caption = GetStringBetween(HTML, "NP: <a id='npanchor' href=""(you need an account to see links)"">", "</a>")

    PS: If you have to use quotation marks in your code, put two like how I did. Otherwise it not work.
    (you need an account to see links)
    (you need an account to see links)(you need an account to see links)

    ------------------------
    [02/24/2013] Stealth CORE is made into the first standalone Neopets auto-player.
    ------------------------


  2. #2
    Zachafer's Avatar
    Joined
    Dec 2011
    Posts
    1,172
    Userbars
    11
    Thanks
    769
    Thanked
    1,466/678
    DL/UL
    98/0
    Mentioned
    512 times
    Time Online
    24d 14h 8m
    Avg. Time Online
    8m
    Joe I'm pretty sure using Mid$ (even better MidB$) is faster than using Split, especially because the Delimiter parameter is a variant and variants are the slowest data types.

Posting Permissions

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