|
-
Oct 15th, 2010, 05:41 PM
#1
Thread Starter
Member
Find a word
hello ppl
how can i check if a word is in the Sentence
the Sentence is "Micheal wrote 5 times"
i want to check whether "wrote" word is in the Sentence...
and if it contain that word, then add the Sentance to a listbox..
-
Oct 15th, 2010, 05:48 PM
#2
Re: Find a word
If InStr("Micheal wrote 5 times", "wrote") > 0 Then 'it is found. If InStr returns 0 it was not found. Keep in mind it's case sensitive.
And of course that example is a bit pointless since strings were hardcode, you can of course use variables there or string type properties of objects/controls.
-
Oct 17th, 2010, 12:51 PM
#3
Re: Find a word
If this is a Chat program and, or, you have more than one reply in a text box separated by a new line, you may want to consider first using the Split function to assign each line in to an array index. This will make parsing with InStr and loading your listbox much easier to manipulate.
<--- Did someone help you? Please rate their post. The little green squares make us feel really smart!
If topic has been resolved, please pull down the Thread Tools & mark it Resolved.
Is VB consuming your life, and is that a bad thing?? 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|