search using _ when a space is entered

Hello, I am using and API that required the use of _ when there is a space between words. I am looking to find a way so that the user can enter: how will this work but when it calls it will replace the spaces with _ to give how_will_this_work can you help me?
1 answers

You could capture the users request into a String, then use replaceAll to replace spaces with underscores.

replaceAll($StringVariable, ' ', '_')

You could then pass this String to your API.

Hope this helps