LineOps

object LineOps
class Object
trait Matchable
class Any
LineOps.type

Value members

Concrete methods

def append(end: String, lines: Seq[String]): Seq[String]

Append the given text to the last line of the collection

Append the given text to the last line of the collection

example:
 ')'
 111
 222
output:
 111
 222)
def join(lines: Seq[String]): String

Joins collection with a line separator

Joins collection with a line separator

def join(sep: String, lhs: Seq[String], rhs: Seq[String]): Seq[String]

Joins left lines with right arrays using the given separator

Joins left lines with right arrays using the given separator

example:
 ' + '
 123
 456
 ,
 789
 zxy
output:
 123
 456 + 789
       zxy
def joinAll(sep: String, linesLines: Seq[Seq[String]]): Seq[String]

Joins several arrays using the given separator

Joins several arrays using the given separator

example:
 ', '
 123
 456
 ,
 789
 zxy
 ,
 ABC
 DEF
output:
 123
 456, 789
      zxy, ABC
           DEF
def joinCR(sep: String, lhs: Seq[String], rhs: Seq[String]): Seq[String]

Join vertically with carriage return

Join vertically with carriage return

example:
 ','
 123
 456
 ,
 ABC
 DEF
output:
 123
 456, ABC
 DEF
def joinNL(xs: Seq[String], ys: Seq[String]): Seq[String]
example:
 xs = abc
 ys = def

output:
 abc
      | <-- note an extra line here
 def
def joinVAll(sep: String, linesLines: Seq[Seq[String]]): Seq[String]

Vertical Join

Vertical Join

example:
 ','
 123
 456
 ,
 ABC
 DEF
output:
 123
 456,
 ABC
 DEF
def padLine(p: String, str: String): String

Pad s string with the given prefix

Pad s string with the given prefix

example:
 " * "
 ,
 "ABC"
output:
 " * ABC"
def padLine(n: Int, str: String): String

Pad string with N spaces

Pad string with N spaces

example:
 2,
 "ABC"
output:
 "  ABC"
def padLines(p: String, lines: Seq[String]): Seq[String]

Pad several lines with the given prefix

Pad several lines with the given prefix

example:
 " * "
 ,
 "ABC"
 "DEF"
output:
 " * ABC"
 " * DEF"
def padLines(n: Int, lines: Seq[String]): Seq[String]

Pad several lines

Pad several lines

example:
 2
 ,
 "ABC"
 "DEF"
output:
 "  ABC"
 "  DEF"
def padTail(n: Int, lines: Seq[String]): Seq[String]

Pad tail of the array with N spaces

Pad tail of the array with N spaces

example:
 2
 ,
 "ABC"
 "DEF"
output:
 "ABC"
 "  DEF"
def prepend(start: String, lines: Seq[String]): Seq[String]

Prepend the given text to the first line of collection

Prepend the given text to the first line of collection

example:
 '(',
 111
 222
output:
 (111
 222
def quote(s: String): String

Puts a string in quotes

Puts a string in quotes

def split(s: String): Seq[String]

Splits a string into lines

Splits a string into lines

def tabLine(depth: Int, line: String): String

Tabulate one line

Tabulate one line

def tabLines(depth: Int, lines: Seq[String]): Seq[String]

Tab several lines

Tab several lines

def tabTail(depth: Int, text: String): String

Tabulates the tail part of the text

Tabulates the tail part of the text

example:
 2
 "123\n456"
output:
 "123\n  456"
def tabTail(depth: Int, lines: Seq[String]): Seq[String]

Tabulates the tail of the collection

Tabulates the tail of the collection

example:
 2
 "123"
 "456"
output:
 "123"
 "  456"
def tabText(depth: Int, text: String): String

Tabulates text

Tabulates text

example:
 2
 "123\n456"
output:
 "  123\n  456"
def wrap(start: String, end: String, lines: Seq[String]): Seq[String]

Wraps the head and last element of the collection

Wraps the head and last element of the collection

example:
 '(', ')'
 123
 456
output:
 (123
 456)
def wrapEmpty(lines: Seq[String]): Seq[String]

Wrap in empty lines

Wrap in empty lines

example:
 'struct X {', '}'
 "123"
 "456"
output:
 ""
 "123"
 "456"
 ""
def wrapIfMultiline(start: String, end: String, lines: Seq[String]): Seq[String]

Wraps the collection only if it is multiline

Wraps the collection only if it is multiline

example 1:
 '(', ')'
 123
 456
output 1:
 (123
 456)

example 2:
 '(', ')'
 123
output 2:
 123
def wrapIfNonWrapped(start: String, end: String, lines: Seq[String]): Seq[String]

Wrap if not already wrapped

Wrap if not already wrapped

example:
 '(', ')'
 (123
 456)
output:
 (123
 456)

^ already wrapped, do nothing