Left-pad a given string (msg) with a character (symbol) for a given number of bytes (length).
    Return the padded string
355020
def lpad(msg, symbol, length):
    
    if len(msg) >= length:
        return msg
    return symbol * (length - len(msg)) + msg
1131158
function pad(str, width) {
  var len = Math.max(0, width - str.length);
  return str + Array(len + 1).join(' ');
}
1089669
function pad(value, length) {
  value = String(value);
  length = length || 2;

  while (value.length < length) {
    value = '0' + value;
  }

  return value;
}
131411
def pad(text, block_size, zero=False):
    
    num = block_size - (len(text) % block_size)
    ch = b'\0' if zero else chr(num).encode('latin-1')
    return text + (ch * num)
1227717
def concat_padded(base, *args):
    
    ret = base
    for n in args:
        if is_string(n):
            ret = "%s_%s" % (ret, n)
        else:
            ret = "%s_%04i"  % (ret, n + 1)
    return ret
1017620
def pad_version(left, right):
    """"""
    pair = vcmp(left), vcmp(right)

    mn, mx = min(pair, key=len), max(pair, key=len)

    for idx, c in enumerate(mx):

        try:
            a = mx[idx]
            b = mn[idx]
            if type(a) != type(b):
                mn.insert(idx, 0)
        except IndexError:
            if type(c) is int:
                mn.append(0)
            elif isinstance(c, six.string_types):
                mn.append('')
            else:
                raise Exception("pad_version failed (%s) (%s)" % (left, right))

    return pair
501863
public static String pad(String rawString, int length, char padChar)
  {
    String padded = rawString;
    String padFiller = null;

    if (padded.length() == length)
    {
      return padded;
    }

    if (padded.length() < length)
    {
      //
      // Keep a zero string that is big enough to pad the
      // largest field that we have, then to pad each field
      // we just append this string to the field and then
      // substr to the desired size.
      //
      StringBuffer buff = new StringBuffer(length);

      for (int i = buff.length(); i < length; i++)
      {
        buff.append(padChar);
      }
      padFiller = buff.toString();

      padded = rawString + padFiller;
      return padded.substring(0, length);

    }
    else
    {
      return padded.substring(0, length);
    }
  }
1060166
def appendRandomLenPadding(str, blocksize=AES_blocksize):
  ''
  pad_len = paddingLength(len(str), blocksize) - 1
  
  from os import urandom
  
  padding = urandom(pad_len)+chr(pad_len)
  
  return str + padding
443767
private static int contentLength(Object msg) {
        if (msg instanceof MemcacheContent) {
            return ((MemcacheContent) msg).content().readableBytes();
        }
        if (msg instanceof ByteBuf) {
            return ((ByteBuf) msg).readableBytes();
        }
        if (msg instanceof FileRegion) {
            return (int) ((FileRegion) msg).count();
        }
        throw new IllegalStateException("unexpected message type: " + StringUtil.simpleClassName(msg));
    }
701109
function padLeft(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 || ' ';
    var pad = '';
    while (len--) {
        pad += char;
    }
    if (offset)
        return padLeft('', offset, null, char) + pad + val;
    return pad + val;
}
178351
def pad(text, bits=32):
    
    return text + (bits - len(text) % bits) * chr(bits - len(text) % bits)
138709
private static function doPad(
        $string,
        $left,
        $right,
        $substring,
        $encoding = null
    ) {
        $strLength = Mbstring::strlen($string, $encoding);
        $padLength = Mbstring::strlen($substring, $encoding);
        $paddedLength = $strLength + $left + $right;

        if (!$padLength || $paddedLength <= $strLength) {
            return $string;
        }

        $leftStr = Mbstring::substr(str_repeat($substring, (int) ceil($left / $padLength)), 0, $left, $encoding);
        $rightStr = Mbstring::substr(str_repeat($substring, (int) ceil($right / $padLength)), 0, $right, $encoding);

        return $leftStr . $string . $rightStr;
    }
306285
def get_string(self):
    
    return self.left.chr+':'+str(self.left.end)+'-'+self.right.chr+':'+str(self.right.start)
269239
def caesar_cipher(message, key):
    
    LEFTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
    translated = ''
    message = message.upper()
    for symbol in message:
        if symbol in LEFTERS:
            num = LEFTERS.find(symbol)
            num = num + key

            if num >= len(LEFTERS):
                num = num - len(LEFTERS)
            elif num < 0:
                num = num + len(LEFTERS)

            translated = translated + LEFTERS[num]
        else:
            translated = translated + symbol

    return translated
1346229
function pad(value, length) {
		value = '' + value;
		return '000000'.substring(0, length - value.length) + value;
	}
1170125
def split_msg(msgs: List[bytes], max_len: int) -> Tuple[str, List[bytes]]:
    """"""
    msg = ""
    while len(msg.encode()) < max_len:
        if len(msg.encode()) + len(msgs[0]) > max_len:
            return msg, msgs
        char = msgs.pop(0).decode()
        # If we have a space within 15 chars of the length limit, split there to avoid words being broken up.
        if char == " " and len(msg.encode()) > max_len - 15:
            return msg, msgs
        msg += char
    return msg, msgs
1095279
function pad(str) {
  if (str.length < max) {
    return str + ' '.repeat(max - str.length);
  }
  return str;
}