public function limit(int $length)
    {
        $string = $this->string;

        if ($this->length() > $length) {
            $string = substr($string, 0, $length);
        }

        return new static($string, $this->encoding);
    }
public function limit(int $length)
    {
        $string = $this->string;

        if ($this->length() > $length) {
            $string = substr($string, 0, $length);
        }

        return new static($string, $this->encoding);
    }
public function limit ( int $ length ) { $ string = $ this -> string ; if ( $ this -> length ( ) > $ length ) { $ string = substr ( $ string , 0 , $ length ) ; } return new static ( $ string , $ this -> encoding ) ; }
Limit the length of the string to a given value

@param int $length Desired length the string should be

@return $this
Limit the length of the string to a given value