RemoveEmptyLines(text) Last updated: 13. Nov 2023

Remove all empty lines (if any) from a string.

Parameters

Name Type Description
text string Text to remove empty lines from.

Returns

String where all empty lines have been removed.

Example

Code example (#JS)

#JS is mixed HTML (or other text file) with inline JavaScript with # starting and ending each inline statement.
#{
    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>

Output

The #JS code above produces the output shown below:

<b>Before</b>:
<div>
1


2</div>

<b>After</b>:
<div>
1
2
</div>