Awee

lines

Lines splits a string or byte slice into an array of lines.

Lines splits a string or byte slice into an array of lines.

Input

string bytes

Parameters

None

Returns

array

Examples

Split a multi-line note

Input

note = "Buy milk\nWalk the dog\nPay rent"

Template

{{ note | lines }}

Output

["Buy milk", "Walk the dog", "Pay rent"]

Take only the first line of a message

Input

message = "Subject: Welcome\nThanks for signing up!"

Template

{{ message | lines | first }}

Output

Subject: Welcome

How is this guide?

On this page