Hi. I would like to know how I could replace a string with a character?
For example, I have a string: "Hello, this is a string"
What if I wanted to replace every single character in the string with an underscore? It would be like: "______ ____ __ _ ______"
How would I put that into a script?
I don't really know much about string manipulation. Thanks!
You can use regex to replace the characters, like "[%a%p%c]", you will just plug it in gsub and it will work. Example:
local FilterCharacter = "_" local String = "Wow, I'm a string" local FilteredString = string.gsub(String, "[%a%p%c]", FilterCharacter) print(FilteredString)