Page 1 of 1

Query regarding the function contains(s, search)

Posted: 01 Sep 2016 09:17
by akhileshg1988
Hello!
Could anyone please tell me how to correctly use the function contains(s, search) if I want the exact match (i.e. if I want the function to check whether the entire substring "search" is exactly contained in the string "s" or not).
In other words, even if a part of the substring "search" is present in the string "s", the function returns "true". I rather want that the function should return "true" only if the entire substring exactly matches with some part (or whole) of string "s".

Thanks
Akhilesh

Re: Query regarding the function contains(s, search)

Posted: 01 Sep 2016 14:15
by MURTUMA
You have a box full of toy cars. You search for one specific car and finally find it from the box. Did the box contain the car you were looking for, or did the entire contents of the box match the car you were looking for which would mean that there never were but that one specific car?

TLDR:

Code: Select all

This string contains a lot of words
Above string contains the word "contains"...

Code: Select all

This string don't have that word
..while above string does not. Sorry, I just love using similes. :D