We're a community of 1076K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,075,842 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Select/Case based on keyword index

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.

3
Contributors
1
Reply
35 Minutes
Discussion Span
3 Months Ago
Last Updated
3
Views
rgilmore
Newbie Poster
8 posts since Jan 2013
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0

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

Begginnerdev
Practically a Posting Shark
861 posts since Apr 2010
Reputation Points: 184
Solved Threads: 141
Skill Endorsements: 8

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page rendered in 0.0566 seconds using 2.69MB