Query regarding the function contains(s, search)

Post your questions and help other users.

Moderator: Martin

Post Reply
akhileshg1988
Posts: 109
Joined: 16 Apr 2014 04:57

Query regarding the function contains(s, search)

Post by akhileshg1988 » 01 Sep 2016 09:17

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

User avatar
MURTUMA
Posts: 697
Joined: 05 Mar 2013 22:43

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

Post by MURTUMA » 01 Sep 2016 14:15

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

Post Reply