1.11M Members

Select/Case based on keyword index

 
0
 

Here is the goal. I have a document that I want to search through word by word based on an array of keywords.

I.E...

Dim keywords() = {"each", "it", "and", "I"}
Dim i As Integer
        For Each key As String In keywords
            Do Until i = Procedure.LastIndexOf(key)
                Search = Procedure.IndexOf(key)
                i = Procedure.IndexOf(key, i + 1)
                Select Case key
                Case "each"
                    MsgBox(key)
                Case "it"
                    MsgBox(key)
                Case "I"
                    MsgBox(key)
                Case "I"
                    MsgBox(key)
                Case Else
                    MsgBox(N/A)
            End Select
        Loop

From this point I want to select a case statement based on the current keyword and its position in a string. I've figured out to find each occurance of the key, but I want to be able to search for all keys at the same time in order of their occurance.

Any help is good help.

 
0
 

If you want to search for all occurrances simultaneously, then you might want to check into multithreading.

You
This article has been dead for over six months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article