Results 1 to 2 of 2

Thread: VB HTML QUESTION! PLEASE HELP!

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 2000
    Posts
    99

    Arrow

    Ok, I'm trying to make a program that reads an HTML file, removes everything above a string, and below a string, then, takes the isolated string, and check if it's different from another string. How do I do this????? I'm new to VB, so some code would help. Here's an example:

    Jim, steve, and Tom's new girlfriend is suzy.

    How could I >REMOVE< the "Jim, Steve, and ", and >REMOVE< the "is suzy." and save "Tom's new girlfriend". ? Then see if "Tom's new girlfriend" is different from "Tom's 333 new girlfriend". ?

    Thanks!
    ___________________________
    Chris

  2. #2
    New Member
    Join Date
    Sep 2000
    Posts
    1

    Wink solution

    Private Sub Form_Load()
    Dim str As String
    Dim STARTPos As Long
    Dim lngStrLength As Long

    str = "Jim, steve, and Tom's new girlfriend is suzy. "
    str2 = "Tom's 333 new girlfriend"
    str3 = "Tom's new girlfriend"

    'get the length of the string to search for
    lngStrLength = Len(str3)

    'Find out where that string starts
    STARTPos = InStr(1, str, str3, vbTextCompare)

    'recreate that string by first grabbing all that is left (previous) to it
    ' and then appending all that is right to it ,minus the total length of
    'the string you were searching for plus the first portion!
    str = Left(str, STARTPos - 1) & Right(str, Len(str) - (lngStrLength + STARTPos))

    'compare the two strings
    If str3 <> str2 Then
    'do something here
    End If

    End Sub

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