Searching for words in a phrase.

[b][red]This message was edited by James98765 at 2004-12-24 20:46:8[/red][/b][hr]
I was making a program that involved looking for a certain word in an entire textbox full of text. For instance, if I wanted the computer to look for the word [blue]is[/blue] in an entire sentence, how would I aproach that? Thank you very much for your time.


Comments

  • : [b][red]This message was edited by James98765 at 2004-12-24 20:46:8[/red][/b][hr]
    : I was making a program that involved looking for a certain word in an entire textbox full of text. For instance, if I wanted the computer to look for the word [blue]is[/blue] in an entire sentence, how would I aproach that? Thank you very much for your time.
    :
    :
    :
    You can do it like this as far as I understand your question.

    Dim str as string
    dim LocationOfTheWord as integer
    str=TxtBox.text
    LocationOfTheWord=str.indexof(" is ")

    I used " is " because if you use "is", you will get any 'is' inside a word, so be carefull about this...

  • : : [b][red]This message was edited by James98765 at 2004-12-24 20:46:8[/red][/b][hr]
    : : I was making a program that involved looking for a certain word in an entire textbox full of text. For instance, if I wanted the computer to look for the word [blue]is[/blue] in an entire sentence, how would I aproach that? Thank you very much for your time.
    : :
    : :
    : :
    : You can do it like this as far as I understand your question.
    :
    : Dim str as string
    : dim LocationOfTheWord as integer
    : str=TxtBox.text
    : LocationOfTheWord=str.indexof(" is ")
    :
    : I used " is " because if you use "is", you will get any 'is' inside a word, so be carefull about this...
    :
    Thank you so much for you help. The code works great. Thanks a million
    :

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories