weird, maybe someone knows the answer?

Discussion in 'Code Snippets and Tutorials' started by Pankirk, Apr 6, 2007.

  1. Pankirk

    Pankirk Level III

    Joined:
    Nov 12, 2006
    Messages:
    652
    Likes Received:
    28
    Location:
    America
    I got this source to some program, it uses HTTPwrapper but theres one par in the code that says "HTTPwrapper.ib". so i searched and it turns out that ".ib: stands for "ibetween" but I cant seem to find a function like GetStringBetween 0_o its weird maybe someone can tell me it? :p
     
  2. ricky92

    ricky92 Administrator
    Staff Member

    Joined:
    Nov 10, 2006
    Messages:
    1,866
    Likes Received:
    67
    That was not made by me!!!
    Code (Text):
    1. Public Function iBetween(ByVal InputText As String, ByVal StartText As String, ByVal EndText As String, Optional ByVal StartPosition = 1) As String
    2.  
    3.     Dim lnTextStart As Long
    4.     Dim lnTextEnd As Long
    5.  
    6.     lnTextStart = InStr(StartPosition, InputText, StartText, vbTextCompare) + Len(StartText)
    7.     lnTextEnd = InStr(lnTextStart, InputText, EndText, vbTextCompare)
    8.     If lnTextStart >= (StartPosition + Len(StartText)) And lnTextEnd > lnTextStart Then
    9.         iBetween = Mid$(InputText, lnTextStart, lnTextEnd - lnTextStart)
    10.     Else
    11.         iBetween = ""
    12.     End If
    13. End Function
     
  3. Pankirk

    Pankirk Level III

    Joined:
    Nov 12, 2006
    Messages:
    652
    Likes Received:
    28
    Location:
    America
    Dang. That doesnt work either =/ thanks for your help though
     
  4. the_skip

    the_skip Level IV

    Joined:
    Dec 25, 2006
    Messages:
    2,354
    Likes Received:
    1
    Location:
    Indiana
    I use this for getting between. if there is something that has lststuff or a string after it it could be extract all. Here is get between
    Code (Text):
    1. '//This is Mumei's, it just in here because it's convenient.
    2. Public Function GetStringBetween(ByVal InputText As String, _
    3. ByVal StartText As String, _
    4. ByVal EndText As String, _
    5. Optional ByVal StartPosition = 1) As String
    6.  
    7.     Dim lnTextStart As Long
    8.     Dim lnTextEnd As Long
    9.  
    10.     lnTextStart = InStr(StartPosition, InputText, StartText, vbTextCompare) + Len(StartText)
    11.     lnTextEnd = InStr(lnTextStart, InputText, EndText, vbTextCompare)
    12.     If lnTextStart >= (StartPosition + Len(StartText)) And lnTextEnd > lnTextStart Then
    13.         GetStringBetween = Mid$(InputText, lnTextStart, lnTextEnd - lnTextStart)
    14.     Else
    15.         GetStringBetween = ""
    16.     End If
    17. End Function
    don't have it httpwrapper.getbetween have it getstringbetween
     
  5. Pankirk

    Pankirk Level III

    Joined:
    Nov 12, 2006
    Messages:
    652
    Likes Received:
    28
    Location:
    America
    yeah i have tried making the ib on a new line without the HTTPwrapper but that didnt turn out too well. so im gona try GSB again.

    edit: ok weird... i just added the GSB to the HTTPwrapper and guess what... it works 0_o lol thanks for telling me to use GSB :)