equal
deleted
inserted
replaced
95 |
95 |
96 def cat_lines(lines: TraversableOnce[String]): String = lines.mkString("\n") |
96 def cat_lines(lines: TraversableOnce[String]): String = lines.mkString("\n") |
97 |
97 |
98 def split_lines(str: String): List[String] = space_explode('\n', str) |
98 def split_lines(str: String): List[String] = space_explode('\n', str) |
99 |
99 |
|
100 def prefix_lines(prfx: String, str: String): String = |
|
101 if (str == "") str |
|
102 else cat_lines(split_lines(str).map(s => prfx + s)) |
|
103 |
100 def first_line(source: CharSequence): String = |
104 def first_line(source: CharSequence): String = |
101 { |
105 { |
102 val lines = separated_chunks(_ == '\n', source) |
106 val lines = separated_chunks(_ == '\n', source) |
103 if (lines.hasNext) lines.next.toString |
107 if (lines.hasNext) lines.next.toString |
104 else "" |
108 else "" |