How to change spaces to underscore and make string case insensitive? April 22, 2023 by Tarik use replaceAll and toLowerCase methods like this: myString = myString.replaceAll(" ", "_").toLowerCase()