Split and input text and add % at start and end of split

So I know there are some smart people out there that could help with this.
I have a search input which filters a custom query using LIKE
Issus I am having is I need to split the search words and add % and the beginning and end

Example:
cz 22
needs to be
%cz%&%22%

does anyone have any idea how I can do this from submitting the form ?

@Teodor @George sorry to be a pain, but would would you have any ideas??

Hello smart friend,

  1. Split string into array (split by character " ")
    [“cz”, “22”]

  2. Repeat/loop array
    2.1) Set Value $value = “%” + $value + “%”
    ["%cz%", “%22%”]

  3. Join array into string (join by character “&”)
    %cz%&%22%

Hope this helps you a little

Try something like:

{{text1.value ? text1.value.split(' ').map('% + $value + %').join('&') : ''}}

where text1 is the name of your text input.
Or do it on the server side, if you need it there, as explained by @Apple in the previous post :slight_smile: