Version: v0.8.1 - Beta.  We welcome contributors & feedback.

String.splitLines

splitLines($options={}) -> list

Description

Split into a List, separated by newlines.

It discards blank lines unless $options is -keepWhitespace.

$body = '''

    line 1.

    line 2!

'''

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

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

See Also