Pad the string to a certain length with another string.

@param int    $length Length to which to pad.
@param string $padString String that will be appended.

@throws StringObjectException
@return $this
348974
public function padRight($length, $padString)
    {
        if (!$this->isNumber($length)) {
            throw new StringObjectException(StringObjectException::MSG_INVALID_ARG, [
                '$length',
                'integer'
            ]);
        }

        if (!$this->isString($padString)) {
            throw new StringObjectException(StringObjectException::MSG_INVALID_ARG, [
                '$padString',
                'string'
            ]);
        }

        $this->val(str_pad($this->val(), $length, $padString, STR_PAD_RIGHT));

        return $this;
    }
1262101
public function padRight( $length, $padString ) {
		return new GString( str_pad( $this->value, $length, $padString, STR_PAD_RIGHT ) );
	}
986414
public static function mb_str_pad(string $input, int $pad_length, string $pad_string = " ", int $pad_type = STR_PAD_RIGHT, string $encoding = "UTF-8")
    {
        $input_length = mb_strlen($input);
        switch ($pad_type) {
            case STR_PAD_RIGHT :
                return $input . self::mb_fill_string($pad_string, $pad_length - $input_length);
            case STR_PAD_LEFT :
                return self::mb_fill_string($pad_string, $pad_length - $input_length) . $input;
            case STR_PAD_BOTH :
                return self::mb_fill_string($pad_string, (int) floor(($pad_length - $input_length) / 2), $encoding)
                    . $input
                    . self::mb_fill_string($pad_string, (int) ceil(($pad_length - $input_length) / 2), $encoding);
            default :
                throw new \InvalidArgumentException("mb_str_pad(): Padding type has to be STR_PAD_LEFT, STR_PAD_RIGHT or STR_PAD_BOTH");
        }
    }
360287
public function setLength($length)
    {
        $length = intval($length);
        $this->length = empty($length) ? 1 : $length;

        return $this;
    }
394959
public function setLength($length)
    {
        if (intval($length) < 0) {
            throw new \LengthException(sprintf('Invalid length: %d', $length));
        }

        $this->length = intval($length);

        return $this;
    }
315044
function pad(number, length) {
	// Create an array of the remaining length +1 and join it with 0's
	return new Array((length || 2) + 1 - String(number).length).join(0) + number;
}
1311613
public function truncate($length)
    {
        $this->_text = StringHelper::truncate($this->_text, $length);
        
        return $this;
    }
538588
public function pad($pad_length, $pad_string = ' ', $pad_type = STR_PAD_RIGHT)
        {
            $string = $this->get();
            $value = str_pad($string, $pad_length, $pad_string, $pad_type);
            $this->update($value);
            return $this;
        }
894757
public static function str_pad($str, int $pad_length, $pad_string=' ', int $pad_type=\STR_PAD_RIGHT) {
		ref\mb::str_pad($str, $pad_length, $pad_string, $pad_type);
		return $str;
	}
1275682
public function getStrPad($input, $padLength, $padString = 0, $padType = STR_PAD_LEFT)
    {
        return str_pad($input, $padLength, $padString, $padType);
    }
939461
public function padStringFilter($value, $padCharacter, $maxLength, $padType = 'STR_PAD_RIGHT')
    {
        if ($this->isNullOrEmptyString($padCharacter)) {
            throw new \InvalidArgumentException('Pad String Filter cannot accept a null value or empty string as its first argument');
        }
        if ( ! is_int($maxLength)) {
            throw new \InvalidArgumentException('Pad String Filter expects its second argument to be an integer');
        }
        $diff = (function_exists('mb_strlen'))? strlen($value) - mb_strlen($value) : 0;
        $padType = constant($padType);

        return str_pad($value, $maxLength + $diff, $padCharacter, $padType);
    }
371210
protected function padString($string, $blockSize = 32)
    {
        $paddingSize = $blockSize - (strlen($string) % $blockSize);
        $string      .= str_repeat(chr($paddingSize), $paddingSize);

        return $string;
    }
634388
protected function pad($str, $final_length, $padding_side = 'right')
    {
        $padding = $final_length - $this->lengthWithoutTags($str);

        if ($padding_side == 'left') {
            return str_repeat(' ', $padding) . $str;
        }

        return $str . str_repeat(' ', $padding);
    }
561826
public function mb_str_pad($input, $pad_length, $pad_string = ' ', $pad_type = STR_PAD_RIGHT)
    {
        $diff = strlen($input) - mb_strlen($input);
        return str_pad($input, $pad_length + $diff, $pad_string, $pad_type);
    }
554663
private function intToMaxLengthHex($value, $length)
    {
        return str_pad(substr(dechex($value), 0, $length), $length, '0', STR_PAD_LEFT);
    }
1095279
function pad(str) {
  if (str.length < max) {
    return str + ' '.repeat(max - str.length);
  }
  return str;
}
1188458
protected function padTrim($input, $pad = '0', $length = 3, $mode = STR_PAD_LEFT)
    {
        // Make sure we have a string.
        if (!is_string($input)) {
            $input = (string) $input;
        }

        return substr(str_pad($input, $length, $pad, $mode), 0, $length);
    }