How do I get a partial match when searching an array?

0 favourites
  • 2 posts
From the Asset Store
$16 USD
Searching is a game where you are challenged to find all the images with the requested letter in 30 seconds.
  • Hi. I added a search box to my app and want to let users search for things in an array. The array stores some recipe data (itemname, part1, part2, part3, requiredskill...).

    I tried to use "Array: For each XY Element" and "Current Value = Searchbox.Text" but this does only give results when you enter the exact names of the values.

    How can I return partial results for an entry like "Knife" when the user enters "Kn" or "fe"? Do I need to use the RegEx actions or is there some other/easier way to do this?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Hi! After trying some things I think I found a solution. There may be many ways to improve it but it works for now.

    I added a Dictionary object to remove duplicates (full text search in array finds the word in itemname, parts, description and would show multiple buttons for the same item). If anyone knows a better/faster way to do this I would be glad to hear about it.

    Maybe someone else can need this for a future project. Here is the code:

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)