Like above, but in lines instead of a big string
169677
public static function getLines($file)
    {
        return !is_file($file) || !is_readable($file) || !($lines = @file($file, FILE_SKIP_EMPTY_LINES)) ? [] : $lines;
    }
287135
def underline(text):
    ''''''

    text += "\n"
    for i in range(len(text)-1):
        text += "="
    text += "\n"
    return text
832509
def _insert_line(self, count=1):
        
        trimmed = self.display[:self.y+1] + \
                  [u" " * self.size[1]] * count + \
                  self.display[self.y+1:self.y+count+1]
        self.display = trimmed[:self.size[0]]
492788
def join_wrapped_lines(lines):
    
    if len(lines) == 1:
        return lines[0]

    joined = lines[0]
    for line in lines[1:]:
        if joined and joined[-1] in STRIP_SPACE_CHARS:
            joined += line
        else:
            joined += ' '
            joined += line

    return joined
771215
def _tree_line(self, no_type: bool = False) -> str:
        """"""
        keys = (" [" + " ".join([k[0] for k in self.keys]) + "]"
                if self.keys else "")
        return super()._tree_line() + keys
492351
def wrap (text, width, **kwargs):
    """"""
    if width <= 0 or not text:
        return text
    ret = []
    for para in get_paragraphs(text):
        text = " ".join(para.strip().split())
        ret.extend(textwrap.wrap(text, width, **kwargs))
    return os.linesep.join(ret)
93523
function buildLineToIndex(str) {
  var lines = str.split("\n"),
      lineToIndex = new Array(lines.length),
      index = 0;

  for (var i = 0, l = lines.length; i < l; i++) {
    lineToIndex[i] = index;
    index += lines[i].length + /* "\n".length */ 1;
  }
  return lineToIndex;
}
540431
function makeLine(text, markedSpans, estimateHeight) {
    var line = {text: text};
    attachMarkedSpans(line, markedSpans);
    line.height = estimateHeight ? estimateHeight(line) : 1;
    return line;
  }
929627
def unindent(self, lines):
        """"""
        indent = min(
            len(self.re.match(r'^ *', line).group()) for line in lines)
        return [line[indent:].rstrip() for line in lines]
684458
function lineTop (){
    var l = line(chars.top
               , chars['top-left'] || chars.top
               , chars['top-right'] ||  chars.top
               , chars['top-mid']);
    if (l)
      ret += l + "\n";
  }
307319
function foldString(string, width) {
  // In folded style, $k$ consecutive newlines output as $k+1$ newlines—
  // unless they're before or after a more-indented line, or at the very
  // beginning or end, in which case $k$ maps to $k$.
  // Therefore, parse each chunk as newline(s) followed by a content line.
  var lineRe = /(\n+)([^\n]*)/g;

  // first line (possibly an empty line)
  var result = (function () {
    var nextLF = string.indexOf('\n');
    nextLF = nextLF !== -1 ? nextLF : string.length;
    lineRe.lastIndex = nextLF;
    return foldLine(string.slice(0, nextLF), width);
  }());
  // If we haven't reached the first content line yet, don't add an extra \n.
  var prevMoreIndented = string[0] === '\n' || string[0] === ' ';
  var moreIndented;

  // rest of the lines
  var match;
  while ((match = lineRe.exec(string))) {
    var prefix = match[1], line = match[2];
    moreIndented = (line[0] === ' ');
    result += prefix
      + (!prevMoreIndented && !moreIndented && line !== ''
        ? '\n' : '')
      + foldLine(line, width);
    prevMoreIndented = moreIndented;
  }

  return result;
}
918270
function(text, pad) {
			var lines = this.splitByLines(text);
			var pl = pad.length;
			for (var i = 0, il = lines.length, line; i < il; i++) {
				line = lines[i];
				if (line.substr(0, pl) === pad) {
					lines[i] = line.substr(pl);
				}
			}
			
			return lines.join('\n');
		}
1088732
def dashed_line(self, x1,y1,x2,y2, dash_length=1, space_length=1):
        """"""
        self._set_dash(dash_length, space_length)
        self.line(x1, y1, x2, y2)
        self._set_dash()
204648
function intendLines (string, trim, intend) {
  var intendStr = new Array(intend + 1).join(' ')

  return string
    .split('\n')
    .map(function (s) {
      return trim ? s.trim() : s
    })
    .join('\n')
    .replace(/^/gm, intendStr)
}
1186587
function wrap(str, lineLength) {
    str = (str || '').toString();
    lineLength = lineLength || 76;

    if (str.length <= lineLength) {
        return str;
    }

    let result = [];
    let pos = 0;
    let chunkLength = lineLength * 1024;
    while (pos < str.length) {
        let wrappedLines = str
            .substr(pos, chunkLength)
            .replace(new RegExp('.{' + lineLength + '}', 'g'), '$&\r\n')
            .trim();
        result.push(wrappedLines);
        pos += chunkLength;
    }

    return result.join('\r\n').trim();
}
612918
function indent(string, indent) {
    return string.split('\n').map(function (line) {
        return indent + line;
    }).join('\n');
}
238990
function(text, pad) {
			var result = [];
			var lines = this.splitByLines(text);
			var nl = '\n';
				
			result.push(lines[0]);
			for (var j = 1; j < lines.length; j++) 
				result.push(nl + pad + lines[j]);
				
			return result.join('');
		}