Version: v0.5.1 - Beta.  We welcome contributors & feedback.  THanks!

String.splitLines

splitLines(keepWhitespace = false)

Description

Split into a List, separated by newlines.

It discards blank lines unless keepWhitespace is true,

let body = '''

    line 1.

    line 2!

''';

body.splitLines();
//= ['line 1.', 'line 2!']

body.splitLines(true);
//= ['', 'line 1.', '', 'line 2!', '']

See Also