1,105,371 Community Members

Select/Case based on keyword index

Member Avatar
rgilmore
Newbie Poster
8 posts since Jan 2013
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
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.

Member Avatar
Begginnerdev
Veteran Poster
1,141 posts since Apr 2010
Reputation Points: 251 [?]
Q&As Helped to Solve: 191 [?]
Skill Endorsements: 15 [?]
 
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 three months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article