Left-pad utility.

@param {string} str String to pad
@param {number} width Total desired width of string
@return {string}
481245
function lpad (str, width) {
  while (String(str).length < width) {
    str = ' ' + str
  }
  return str
}
860984
public static String leftStr(String str, int length) {
		return str.substring(0, Math.min(str.length(), length));
	}
495542
function paddRight(str, length, what) {
	if (length <= str.length) {
		return str.substring(0, length);
	}
	what = what || ' ';
	return str + what.repeat(length - str.length);
}
254327
def _padleft(width, s, has_invisible=True):
    

    def impl(val):
        iwidth = width + len(val) - len(_strip_invisible(val)) if has_invisible else width
        fmt = "{0:>%ds}" % iwidth
        return fmt.format(val)

    num_lines = s.splitlines()
    return len(num_lines) > 1 and '\n'.join(map(impl, num_lines)) or impl(s)
288280
function getWidth(stringWidth, str) {
	if (!stringWidth || !stringWidth.toLowerCase)
		return str.length;
	switch (stringWidth.toLowerCase()) {
		case "wcwidth":
			return wcwidth(str);
		case "dbcs":
			return dbcswidth(str);
		case "length":
			return str.length;
		default:
			return str.length;
	}
}
610036
function handleStrs(strs, opts) {
  const len = longest(strs)
  const text = strs
    .map(pad(len, opts.justify))
    .map(wrap(opts))
    .join('')
  return {len, text}
}
84032
public static StringBuffer leftShift(String self, Object value) {
        return new StringBuffer(self).append(value);
    }
362923
public static function padRight(string $str, int $length, string $with = ' ', string $encoding = null) : string
    {
        return static::pad($str, $length, $with, STR_PAD_RIGHT, $encoding);
    }
650183
function createPadding (width) {
  var result = ''
  var string = ' '
  var n = width
  do {
    if (n % 2) {
      result += string;
    }
    n = Math.floor(n / 2);
    string += string;
  } while (n);

  return result;
}
677490
public static String pad (String value, int width, char c)
    {
        // sanity check
        if (width <= 0) {
            throw new IllegalArgumentException("Pad width must be greater than zero.");
        }
        int l = value.length();
        return (l >= width) ? value
                            : value + fill(c, width - l);
    }
969313
function pad(text, length, align = 'left') {
  let pad = ' '.repeat(length - stringWidth(text));
  if (align === 'right') {
    return pad + text;
  }

  return text + pad;
}
314683
function padRight(x, padding) {
  if (x) {
    x += '';
  } else {
    x = '';
  }
  var buf = [];
  while (buf.length + x.length < padding) {
    buf.push('0');
  }
  return x + buf.join('');
}
173064
function padRight(val, len, offset, char) {
    /* istanbul ignore if */
    if (!is_1.isValue(val) || !is_1.isString(val))
        return null;
    // If offset is a string
    // count its length.
    if (is_1.isString(offset))
        offset = offset.length;
    char = char || ' ';
    while (len--) {
        val += char;
    }
    if (offset)
        val += padRight('', offset, null, char);
    return val;
}
134830
function (expr, length, fillChar) {
  fillChar = fillChar || ' ';
  var string = '' + expr;
  if (string.length > length) {
    return left(string, length);
  } else {
    while (string.length < length) {
      string = fillChar + string;
    }
  }
  return string;
}
519977
function (str) {
    var lit = this.ast_stringify(t.stringLiteral(str));
    var ast = this.ast_buffer(lit);
    return ast;
  }
1129777
public function stringPad($input, $pad_length, $pad_string = ' ')
    {
        $count = strlen($input);

        // Fix μ issues
        if(strpos($input, 'μ'))
            $count--;

        $space = $pad_length - $count;

        return str_repeat($pad_string, $space) . $input;
    }
561089
def pad_char(text: str, width: int, char: str = '\n') -> str:
    """"""
    dis = width - len(text)
    if dis < 0:
        raise ValueError
    if dis > 0:
        text += char * dis
    return text