next | previous | forward | backward | up | top | index | toc | Macaulay2 web site
Macaulay2Doc > The Macaulay2 language > strings and nets > lines

lines -- split a string into lines

Description

Synopsis

  • Usage:
    lines s
  • Inputs:
  • Outputs:
    • an array of strings obtained from the string s by breaking it into lines

Synopsis

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

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"}

See also

Ways to use lines :