Search Algorithm

I Am Making A Word Processing Program.
I Have Tagged The Document With Hyperlinks (Using RTF Format).
I Want To Be Able To Search For The Hyperlinks, During Loading of Document, And Place Them Into A Seperate Form, For Users To Easily Browse Through The Hyperlinks.

This Is How The File Is Tagged, In Pure Text Format.
{~WLMicrosoft Home Page;http://www.microsoft.com}
I've Used "{~WL" So It Would Be Easy To Search For A Web Link.
But I Can't Seem To Do Any Of It.

Comments

  • : I Am Making A Word Processing Program.
    : I Have Tagged The Document With Hyperlinks (Using RTF Format).
    : I Want To Be Able To Search For The Hyperlinks, During Loading of Document, And Place Them Into A Seperate Form, For Users To Easily Browse Through The Hyperlinks.
    :
    : This Is How The File Is Tagged, In Pure Text Format.
    : {~WLMicrosoft Home Page;http://www.microsoft.com}
    : I've Used "{~WL" So It Would Be Easy To Search For A Web Link.
    : But I Can't Seem To Do Any Of It.
    :
    Try with this algorithm:

    [code]Dim I as Integer, asd as String
    Dim Pos1 as Integer, Pos2 as Integer, Pos3 as Integer

    For I = 1 to Len([i]string to analyze[/i]) - 1
    asd = Mid([i]string[/i], 1, I)
    If asd = "{" Then
    Pos1 = I
    ElseIf asd = ";" Then
    Pos2 = I
    ElseIf asd = "}" Then
    Pos3 = I
    If Pos2 > Pos1 Then 'it's not a sure sistem, but it works
    [i]noun[/i] = Mid([i]string[/i], Pos2 -1 - Pos1 + 4, Pos1 + 4)
    [i]hyperlink[/i] = Mid([i]string[/i], Pos3 - Pos2, Pos2)
    End If
    End If
    Next I[/code]

    I think it's quite clear how it works: it analyzes the string letter a time and decides if it is the beginning, the "middle" or the end of the hyperlink.
    Adapt it to your uses and good luck
  • Thank You For That. I Did Have To Adapt It. But It Does Work.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories