Returns a padded string.
    s = string to pad
    n = width of string to return
    sep = separator (on end of string)
    align = text alignment, "left", "center", or "right"
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
456455
def get_string_width(self, s):
        ""
        s = self.normalize_text(s)
        cw=self.current_font['cw']
        w=0
        l=len(s)
        if self.unifontsubset:
            for char in s:
                char = ord(char)
                if len(cw) > char:
                    w += cw[char] # ord(cw[2*char])<<8 + ord(cw[2*char+1])
                #elif (char>0 and char<128 and isset($cw[chr($char)])) { $w += $cw[chr($char)]; }
                elif (self.current_font['desc']['MissingWidth']) :
                    w += self.current_font['desc']['MissingWidth']
                #elif (isset($this->CurrentFont['MissingWidth'])) { $w += $this->CurrentFont['MissingWidth']; }
                else:
                    w += 500
        else:
            for i in range(0, l):
                w += cw.get(s[i],0)
        return w*self.font_size/1000.0
1333730
function string (str, index){
    var str = String(typeof str == 'object' && str.text ? str.text : str)
      , length = utils.strlen(str)
      , width = colWidths[index]
          - (style['padding-left'] || 0)
          - (style['padding-right'] || 0)
      , align = options.colAligns[index] || 'left';

    return repeat(' ', style['padding-left'] || 0)
         + (length == width ? str :
             (length < width
              ? pad(str, ( width + (str.length - length) ), ' ', align == 'left' ? 'right' :
                  (align == 'middle' ? 'both' : 'left'))
              : (truncater ? truncate(str, width, truncater) : str))
           )
         + repeat(' ', style['padding-right'] || 0);
  }
403194
function(string, options) {
      options = options || {};
      var separator = options.separator || '_';
      var split = options.split || /(?=[A-Z])/;

      return string.split(split).join(separator);
    }
1273114
def _to_s(val, sep=", "):
    
    if anyconfig.utils.is_iterable(val):
        return sep.join(str(x) for x in val)

    return str(val)
489756
def _pad(self, data):
        
        length = 16 - (len(data) % 16)
        data += chr(length)*length
        return data
1281696
function calSeparator(str) {
    return calRow(str).map(item => {
        if (item.startsWith(':') && item.endsWith(':')) {
            return 'center';
        } else if (item.startsWith(':')) {
            return 'left';
        } else if (item.endsWith(':')) {
            return 'right';
        } else if (item.endsWith(':')) {
            return '';
        }
    });
}
350788
def get_margin(length):
    """"""
    if length > 23:
        margin_left = "\t"
        chars = 1
    elif length > 15:
        margin_left = "\t\t"
        chars = 2
    elif length > 7:
        margin_left = "\t\t\t"
        chars = 3
    else:
        margin_left = "\t\t\t\t"
        chars = 4
    return margin_left
1285733
function pad( str, chr, n ) {
  return (chr.repeat( Math.max( n - str.length, 0 ) ) + str).substr(-n)
}
1300989
def pad(self, string):
        
        size = len(string)
        target = size * (4.75 - size ** 0.27)
        pad_len = int(target) - size
        return string + self.LOREM[:pad_len] + "#"
838845
function(value, maxLen, padChar) {
        value = value || '';
        return value + _getPadString(value, maxLen, padChar);
    }
1082046
private short getAlignment(String value)
    {
        short ret = ALIGN_LEFT;

        if(value.equals("centre"))
            ret = ALIGN_CENTRE;
        else if(value.equals("left"))
            ret = ALIGN_LEFT;
        else if(value.equals("right"))
            ret = ALIGN_RIGHT;
        else if(value.equals("justify"))
            ret = ALIGN_JUSTIFY;
        else if(value.equals("fill"))
            ret = ALIGN_FILL;

        return ret;
    }
1428
def _padleft(width, s, has_invisible=True):
    
    iwidth = width + len(s) - len(_strip_invisible(s)) if has_invisible else width
    fmt = "{0:>%ds}" % iwidth
    return fmt.format(s)
355472
def bbox_str(bbox, pad=4, sep=', '):
     """
    if bbox is None:
        return 'None'
    fmtstr = sep.join(['%' + six.text_type(pad) + 'd'] * 4)
    return '(' + fmtstr % tuple(bbox) + ')'
1030993
public String dimensonsToString(String sep) {
    StringBuilder result = new StringBuilder(100).append('[');
    for(int dim = BitsUtil.nextSetBit(dimensions, 0); dim >= 0; dim = BitsUtil.nextSetBit(dimensions, dim + 1)) {
      result.append(dim + 1).append(sep);
    }
    if(result.length() > sep.length()) { // Un-append last separator
      result.setLength(result.length() - sep.length());
    }
    return result.append(']').toString();
  }
688858
def _align_header(header, alignment, width, visible_width, is_multiline=False,
                  width_fn=None):
    ""
    if is_multiline:
        header_lines = re.split(_multiline_codes, header)
        padded_lines = [_align_header(h, alignment, width, width_fn(h))
                        for h in header_lines]
        return "\n".join(padded_lines)
    # else: not multiline
    ninvisible = len(header) - visible_width
    width += ninvisible
    if alignment == "left":
        return _padright(width, header)
    elif alignment == "center":
        return _padboth(width, header)
    elif not alignment:
        return "{0}".format(header)
    else:
        return _padleft(width, header)
1131158
function pad(str, width) {
  var len = Math.max(0, width - str.length);
  return str + Array(len + 1).join(' ');
}