Visual Basic String Manipulation

Discussion in 'Web Design & Coding' started by cpugeniusmv, Apr 28, 2003.

  1. cpugeniusmv

    cpugeniusmv Computer Genius

    Messages:
    485
    Here's what I'm trying to do.

    VB6

    I'm trying to get the source code of an EXTREMEMLY LONG page (delimited by the greater than symbol, ">") into a listbox.

    However, I've run into a problem: Whenever I split() it with the ">" delimiter, when it gets to about the 1922nd 'delimit' it says that the subscript is out of range.

    Suggestions?
     
  2. Blitzkrieg

    Blitzkrieg Guest

    I don't completely understand what you are trying to do, can you give an example of the input, the output, and what code you are currently using? I'll take a look and see what I can do.
     
  3. cpugeniusmv

    cpugeniusmv Computer Genius

    Messages:
    485
    dim working as String

    text1.text = (attached html source)

    private sub command1_click()
    x=-1
    do until working = "Take me to the bottom</a"
    x=x+1
    working = Split(text1.text, ">")(x)
    loop
    do until working = vbcrlf & "<a name=bot"
    x=x+3
    working = Split(text1.text, ">")(x)
    list1.additem working
    loop
    end sub

    what this SHOULD do is give me all those text files with a "</a" on the end into list1. but when it get's to about the 1920th one, it says that it's out of range.
     
  4. X-Istence

    X-Istence * Political User

    Messages:
    6,498
    Location:
    USA
    if you dont mind, attach the source code, ill take a look at it.
     
  5. Blitzkrieg

    Blitzkrieg Guest

    Like X-Istence said, attach the code and a copy of the html file you are using if possible.

    If what you are trying to do is what I think, this would be insanely easy to do if you had Unix/Linux commands to work with. This stuff is ez as pi with it :D
     
  6. cpugeniusmv

    cpugeniusmv Computer Genius

    Messages:
    485
    *sigh*

    i feel so stupid...found my mistake.

    thanks anyway guys!
     
  7. Blitzkrieg

    Blitzkrieg Guest

    Can I take a guess? The condition was never being met, so it would keep going even past the end of the input data, and give you an error...hence the out of range error.

    Anyways, good to know that you got it working :D
     
  8. cpugeniusmv

    cpugeniusmv Computer Genius

    Messages:
    485
    correction:

    it was working

    i'll post the source in a second.
     
  9. cpugeniusmv

    cpugeniusmv Computer Genius

    Messages:
    485
    another correction:

    i found a way around it.

    sheesh.