How to search for a keyword in a list of words?

Hello there, hope you are great!

Let’s say I have a list of my users’ names. An item (user’s name) could be just first name & last name (like John Smith), or a full name (like John Henry Smith). What I want to do is, when the user tries to search for someone, if the keyword is in the name, the list should show it. Here’s an example -

Let’s say, this is my list -

  • John Henry Smith
  • Jane William Foster
  • William Smith
  • John Brown

If I simply try to search ‘John’, it should return both item1 & item4 as they both contain John. But here’s where the fun begins - If I search ‘John Smith’, (since there is no item exactly containing John Smith), it should return me item1, as it contains both John and Smith. The key is, the search keyword doesn’t have to match exactly with the items.

Is this sorta thing possible? Searching every word of the entered keyword in an item? Any advice/help is appreciated! Thanks!

1 Like

Try this
https://x.thunkable.com/projectPage/600c35d2f153060012143dc8

1 Like

Hi, @muneer! Thanks a lot for the reply!

In your project, if I search ‘Dr. Williams’ in your list, it doesn’t show me anything, as there’s no Dr. Williams - but Dr. Ted Williams. As I said, if the words of the search keyword are present in any item of the list (in any arrangement), the item should show. Is it possible to create something like I am talking about?

Thanks a lot!

2 Likes

Yes, it is possible.

1 Like

Thanks! Can you suggest any ideas? :slightly_smiling_face:

1 Like

Remix the same project again. I made the requested changes.

1 Like

Ah, I’ve always wanted a ‘round to nearest contain’ block. Basically it ignores little bits and if the item the text is being compared to matches the search ‘when rounded up’, it returns ‘does contain’ as true.
@muneer this is the perfect solution!

2 Likes