V
V
Vimake2014-02-02 21:50:48
C++ / C#
Vimake, 2014-02-02 21:50:48

How to implement search in textbox?

There is a word, for example, elephant.
And in the textBox a list of animals.
Help check for a match of the elephant in the list of animals.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
AlexP11223, 2014-02-03
@Vimake

/elephant/i? Well, this is not JS, there is no /, and i is set differently.
>= 0 because

Return Value: The zero-based index position of value if that string is found, or -1 if it is not.

Or if you just need to find out if it is there or not, then it is better to .Containsuse it.
Or, depending on the task, it may really be better to use RegExp or separate words (by space, etc.) so as not to consider the heffalump as an elephant.
Better yet, don't ask questions that can be answered in any tutorial/documentation/article in the strings section.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question