return a string that contains `i`, left-padded with 0's up to PAD_LEN digits
540547
def paddedInt(i):
    '''
    
    '''
    i_str = str(i)
    pad = PAD_LEN - len(i_str)
    return (pad * "0") + i_str
177993
def pad(s, n, p = " ", sep = "|", align = "left"):
    
    if align == "left":
        return (s + (p * n))[:n] + sep
    elif align == "center":
        pos = n + len(s)/2 - n/2
        return ((p * n) + s + (p * n))[pos:pos + n] + sep
    elif align == "right":
        return ((p * n) + s)[-n:] + sep
1046904
function rpad(str, len, padstr) {
	var str = ""+str;
	if(str.length >= len) return str;
	return str + Array(len + 1 - str.length).join(padstr);
}
201025
def pad_zeroes(addr, n_zeroes):
    """"""
    if len(addr) < n_zeroes:
        return pad_zeroes("0" + addr, n_zeroes)
    return addr
284514
def inttoLEB128(intinput):
    '''
    
    '''

    binstr = str(bin(intinput)) \
             .lstrip("0b").replace("b","").replace("L","") \
             .replace("'","").replace('"',"")
    if len(binstr) % 7:
        binstr = binstr.zfill(len(binstr) + 7 - (len(binstr) % 7))
    bytelist = ""
    for i in range(len(binstr) // 7):
        if i < ((len(binstr) // 7) - 1):
            pad = "1"
        else:
            pad = "0"
        currbyte = binstr[(len(binstr) - (7*i + 7)):(len(binstr) - (7*i))]
        currbyte = pad + currbyte
        currbyte = dechex(int(currbyte,2))
        # assert len(currbyte) == 2
        bytelist = bytelist + currbyte
    return bytelist
685756
def f_string_check(self, original, loc, tokens):
        """"""
        return self.check_py("36", "format string", original, loc, tokens)
763570
function (str) {
    var output = [];
    var idx = 0;
    var c, num;

    var nextNumber = function () {
      var chars = [];

      while (/[^-\d\.]/.test(str.charAt(idx))) {
        // skip the non-digit characters
        idx++;
      }

      if ('-' === str.charAt(idx)) {
        chars.push('-');
        idx++;
      }

      while ((c = str.charAt(idx)) && /[\d\.Ee]/.test(c)) {
        chars.push(c);
        idx++;
      }

      return parseFloat(chars.join(''));
    };

    while (!isNaN(num = nextNumber())) output.push(num);

    return output;
  }
819645
def int_to_string(number, alphabet, padding=None):
    
    output = ""
    alpha_len = len(alphabet)
    while number:
        number, digit = divmod(number, alpha_len)
        output += alphabet[digit]
    if padding:
        remainder = max(padding - len(output), 0)
        output = output + alphabet[0] * remainder
    return output[::-1]
905739
def keep_only_digits(s):
    
    '''
    fs = ''
    for c in s:
        if c.isdigit():
            fs += c

    return int(fs)
21743
def _num_to_string(self, number, pad_to_length=None):
        
        output = ""
        while number:
            number, digit = divmod(number, self._alpha_len)
            output += self._alphabet[digit]
        if pad_to_length:
            remainder = max(pad_to_length - len(output), 0)
            output = output + self._alphabet[0] * remainder
        return output
338434
function _getPadding (source, char, len) {
    if (!isNil(source) && type(source) !== "String") {
        source = String(source);
    }

    return _repeat(String(char)[0] || "", Math.ceil(len - source.length));
}
30777
def _idToStr(self, x):
        
        if x < 0:
            sign = -1
        elif x == 0:
            return self._idChars[0]
        else:
            sign = 1
        x *= sign
        digits = []
        while x:
            digits.append(self._idChars[x % self._idCharsCnt])
            x //= self._idCharsCnt
        if sign < 0:
            digits.append('-')
        digits.reverse()

        return ''.join(digits)
746221
function pad(number, size) {
        var stringNum = String(number);

        while (stringNum.length < (size || 2)) {
            stringNum = '0' + stringNum;
        }

        return stringNum;
    }
1373274
def appendNullPadding(str, blocksize=AES_blocksize):
  ''
  pad_len = paddingLength(len(str), blocksize)

  padding = '\0'*pad_len
  
  return str + padding
650900
def long2str(l):
    """"""
    if type(l) not in (types.IntType, types.LongType):
        raise ValueError('the input must be an integer')

    if l < 0:
        raise ValueError('the input must be greater than 0')
    s = ''
    while l:
        s = s + chr(l & 255)
        l >>= 8

    return s
1368108
def _pad(self, b):
        
        return b + (self.bs - len(b) % self.bs) * chr(self.bs - len(b) % self.bs).encode("UTF-8")
154817
def string_to_int( s ):
  """"""
  result = 0
  for c in s:
    if not isinstance(c, int): c = ord( c )
    result = 256 * result + c
  return result