Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How do I remove blank lines from a string?

Asked by
popeeyy 493 Moderation Voter
4 years ago

In the image, there is a blank line from me doing shift + enter in discord that makes a new line, and then copying and pasting the text into a text box. I use the following code to attempt to remove new lines and compare two strings, one with the extra line and one without. Obviously, this would result in them not equaling each other.

How would I remove the new line to make both strings equal each other?

My current code to remove new lines: (doesn’t work)

v = v:gsub("%s+", ""):gsub("[\n\r]", "") 
0
I'd need to see the part of the code where the text is at, you may have an extra space there or something. Grim_Reaper29 0 — 4y
0
string.gsub(str, "\n", "") -- very late i know (; TommyHArden 101 — 3y

Answer this question