CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: ecannizzo

  1. #1
    Join Date
    Jul 2000
    Posts
    124

    ecannizzo

    I am using the webbrowser control and getting the innertext back. I then need to go through it and extract all the email addresses in the document. I am looking for the @ symbol, and I can get everything from that on, but i can't figure out how to get everything before it and have it cut of at a space or a new line. Any suggestions?

    Thanks!
    Erica


  2. #2
    Join Date
    Feb 2001
    Location
    Stamford CT USA
    Posts
    2,167

    Re: ecannizzo

    Check out the code below to move the index backward till a space is found. Of course you have to modify it to work with your code.


    Sub MoveBack(szHTML as string)
    dim nStartInd as Long
    dim bExit as Boolean
    dim szCurChar as string

    ' look for the @ sign
    nStartInd = InStr(1, szHTML, "@")

    ' loop as long as nStartInd > 0 (begin of string)
    bExit = false
    while ((nStartInd > 0) and (not bExit))
    if (nStartInd - 1) = 0) then
    ' we are at the beginning of the line
    bExit = true
    else
    ' move back
    szCurChar = mid$(szHTML, nStartInd - 1, 1)
    if (szCurChar = " ") then
    ' exit
    bExit = true
    else
    ' move back 1 step
    nStartInd = nStartInd - 1
    end if
    end if
    wend
    End Sub




    Of course, I have not really tested the code but the idea is there. Someone might be able to come up with better solution

    -Cool Bizs

    Good Luck,
    -Cool Bizs

  3. #3
    Join Date
    Jul 2000
    Posts
    124

    Email

    It doesn't exactly work, but I think if I play with it enough I might be able to get what I want out of it.

    Thanks,
    Erica


  4. #4
    Join Date
    Feb 2001
    Location
    Stamford CT USA
    Posts
    2,167

    Re: Email

    Yea .. work on it and if you still stuck, please don't hesistate to either post another message or email me personally.

    -Cool Bizs

    Good Luck,
    -Cool Bizs

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

Featured