Docly Developers
Function Updated 17 Oct 2026

removeEmptyLines(text)

Removes empty lines, and lines that contain only white space, from a string.

Parameters

textstringrequired

Text to remove empty lines from.

Returns

The remaining lines. Every line, including the last one, ends with a line break.

Example

Mixed HTML (or any text file) with inline JavaScript between hash signs.
#{
    var before = "1" + chr(13, 13, 13) + "2";
    var after = docly.removeEmptyLines(before);
}#

<b>Before</b>:
<div>
#before#
</div>

<b>After</b>:
<div>
#after#
</div>