Version: v0.6.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,

$body = '''

    line 1.

    line 2!

''';

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

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

See Also