# lines -- split a string into lines

## Synopsis

• Usage:
lines s
lines(nl, s)
• Inputs:
• s, ,
• nl, ,
• Outputs:
• a list, an array of strings obtained from the string s by breaking it at the characters specified by the string nl

## Description

The form lines s is designed to break lines correctly when the file follows the Unix or MS-DOS convention. In other words, it will break a line at \r\n or \n.

 i1 : lines "a\nb\nc\n" o1 = {a, b, c} o1 : List i2 : peek oo o2 = {"a", "b", "c"} i3 : lines "a\nb\nc\nd" o3 = {a, b, c, d} o3 : List i4 : peek oo o4 = {"a", "b", "c", "d"} i5 : lines( "\\.", "a.b.c." ) o5 = {a, b, c} o5 : List i6 : peek oo o6 = {"a", "b", "c"} i7 : lines( "\\.", "a.b.c.d" ) o7 = {a, b, c, d} o7 : List i8 : peek oo o8 = {"a", "b", "c", "d"}

## Caveat

For backwards compatibility, if the pattern is a single character and it is an unescaped special character, such as +, *, or ., then it is treated as a literal character. In future code, the pattern must be escaped.