public function setLength($newLength, $padding = ' ')
    {
        $newLength     = (int) $newLength;
        $currentLength = $this->length();

        if ($newLength != $currentLength) {
            while ($newLength > $this->length()) {
                $this->string .= $padding;
            }
            if ($newLength < $this->length()) {
                $this->string = mb_substr($this->string, 0, $newLength, $this->encoding);
            }
        }

        return $this;
    }