Fix Line Endings
txt = tools.fixending(txt, [ending], [search])
Fixes the line endings.
By default this changes all CR, CRLF, LF to CRLF.
You can override the choice of CRLF by defining ending
.
Parameter | Type | Description |
---|---|---|
txt |
string | Text to fix |
ending |
string | String to use as line ending. Default = '\r\n' |
search |
string | Which ending characters to replace, Default = '\r\n' |
Returns | Type | Description |
---|---|---|
txt |
string | Fixed string |
e.g.
local txt = tools.fixending(txt, '\r\n', '\r\n\f') -- fix combinations of CR, LF, FF