-
How could I remove all whitespace from my multiline string?
-
I already tried string.gsub(str," “,”"), but it does not seem to work with multiline strings.
-
I have tried string.gsub(str," “,”") which works for single line strings, but I need it for longer. Any alternative/modified solutions are welcome, thanks!
If you take a look at the string function documentation page, you’ll notice .gsub’s second argument is a string pattern instead of just a specific string. To pick up any “space or whitespace character”, you can use %s+
The end result would be: string.gsub(str, "%s+", "")
1 Like
Thanks, will try and let you know whether it solved the problem.
(edit)- It works, thank you!
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.