var name_list = ['Annie','John','Lyam','Mary']
var text_be_checked_1 = 'Annie'
do_some_stuff(name_list, text_be_checked_1) // true
var text_be_checked_2 = 'Ann'
do_some_stuff(name_list, text_be_checked_2) // false
var text_be_checked_3 = '1Annie'
do_some_stuff(name_list, text_be_checked_3) // true
var text_be_checked_4 = 'An2nie'
do_some_stuff(name_list, text_be_checked_4) // false
var text_be_checked_5 = 'Anni_John'
do_some_stuff(name_list, text_be_checked_5) // true
What I want is that determining whether text has full match with name in name_list
like above.
I read this, but this is not exactly what I need.
How can I do this?
I don't care about where the solution came from. javascript or jQuery are all okay.
Would you solve this please?
EDIT:
Thank you everyone, There are many answers and I tested them.
But I thought that I have to add more explanation of my question.
You have to check this:
var name_list = ['Annie','John','Lyam','Mary']
var text_be_checked_3 = '1Annie'
do_some_stuff(name_list, text_be_checked_3) // true
As your answers, from here
Mango
can return true, but 1Mango
, Mango_to
returns false.
This is point, What I want is that 1Mango
and Mango_to
are also return true.
If this explanation is not enough, please comment me.