Padds or truncates a string right.
@param  {String} str    The string to be modified
@param  {Number} length Length of the final string
@param  {String} what   The padding string(should be one character)
@return {String}
495542
function paddRight(str, length, what) {
	if (length <= str.length) {
		return str.substring(0, length);
	}
	what = what || ' ';
	return str + what.repeat(length - str.length);
}
1046904
function rpad(str, len, padstr) {
	var str = ""+str;
	if(str.length >= len) return str;
	return str + Array(len + 1 - str.length).join(padstr);
}
620329
function(str){
	var retstr = str;

	if( ! us.isUndefined(str) && str.length > 2 ){
	    var end = str.length -1;
	    if( str.charAt(0) == '"' && str.charAt(end) == '"' ){
		retstr = str.substr(1, end -1);
	    }
	}

	return retstr;
    }
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);
  }
1362853
function trim(str, targetStr) {
    var retStr = "";
    var regStr;

    if (typeof str != "string") {
        return retStr;
    }

    if (typeof targetStr != "string" || !targetStr) {
        targetStr = "\\s";
    }

    regStr = "^" + targetStr + "*(.*?)" + targetStr + "*$";
    regStr = new RegExp(regStr);

    str = str.replace(regStr, "$1");
    return str;
}
978963
function truncate(input, length, suffix, preserve) {

  length = isUndefined(length) ? input.length : length;
  preserve = preserve || false;
  suffix = suffix || '';

  if(!isString(input) || (input.length <= length)) return input;

  return input.substring(0, (preserve) ?
    ((input.indexOf(' ', length) === -1) ? input.length : input.indexOf(' ', length)) :
    length) + suffix;
}
67099
function(str){
    if(_.isUndefined(str))
        str = '00';
    
    return String(str).length % 2 ? '0' + String(str) : String(str);
}
438687
function pad(num, size) { var result
        result = String(num)
        return result.length >= size?  result
             : /* need padding? */     Array(size).join('0') + result
    }
848690
function cutString(srcStr, length) {
      var tmpChar, tmpStr = '', count = 0, i = -1;
      while (++i < srcStr.length) {
        if (count >= length) break;
        tmpChar = srcStr.substr(i, 1);
        tmpStr += tmpChar;
        count += matchPattern(tmpChar, 'dbChar') ? 2 : 1;
      }
      return tmpStr + '...';
    }
1228683
function(strings) {
			var lengths = strings.map(function(s) {
				return typeof s === 'string' ? s.length : +s;
			});
			
			var max = lengths.reduce(function(prev, cur) {
				return typeof prev === 'undefined' ? cur : Math.max(prev, cur);
			});
			return lengths.map(function(l) {
				var pad = max - l;
				return pad ? this.repeatString(' ', pad) : '';
			}, this);
		}
944685
function (str) {
      var strlen = str.length;
      if (this.html.substr(this.currentChar, strlen).toLowerCase() === str.toLowerCase()) {
        this.currentChar += strlen;
        return true;
      }
      return false;
    }
479887
function trim (str, chars) {
  var fn = toFn(chars || WHITESPACE_CHARS)

  return trim.right(trim.left(str, fn), fn)
}
426670
function truncate(string) {
  if (string.length > SEG_LENGTH * 2 + 3) {
    return string.slice(0, SEG_LENGTH) + '...' + string.slice(-SEG_LENGTH);
  }

  return string;
}
746221
function pad(number, size) {
        var stringNum = String(number);

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

        return stringNum;
    }
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;
}
580504
public static String truncate (String str, int limit, String appendage)
    {
        if (str == null || str.length() <= limit) {
            return str;
        }
        return str.substring(0, limit - appendage.length()) + appendage;
    }
17643
function padEnd (string, targetLength) {
  if (typeof string !== 'string' ||
    typeof targetLength !== 'number') {
    return string
  }

  /* istanbul ignore next */
  const fn = typeof String.prototype.padEnd === 'function'
    ? String.prototype.padEnd
    : polyfill

  return fn.call(string, targetLength)
}