Results 1 to 2 of 2

Thread: [VB6] Fast GetStringBetween

  1. #1
    Saiyan Race
    j03's Avatar
    Joined
    Dec 2011
    Posts
    12,940
    Userbars
    139
    Thanks
    5,425
    Thanked
    29,293/6,111
    DL/UL
    23/36
    Mentioned
    3,678 times
    Time Online
    517d 14h 56m
    Avg. Time Online
    3h 18m

    [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,235
    Userbars
    11
    Thanks
    769
    Thanked
    1,463/678
    DL/UL
    98/0
    Mentioned
    511 times
    Time Online
    24d 12h N/A
    Avg. Time Online
    9m
    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
  •