Results 1 to 3 of 3

Thread: Find a word

  1. #1

    Thread Starter
    Member
    Join Date
    Aug 2008
    Posts
    40

    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..

  2. #2
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989

    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.

  3. #3
    PowerPoster CDRIVE's Avatar
    Join Date
    Jul 2007
    Posts
    2,620

    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
  •  



Click Here to Expand Forum to Full Width