src/Str.php
public function substring(int $start, int $length = null): self
    {
        if ($this->length() === 0) {
            return $this;
        }

        $sub = \mb_substr($this->value, $start, $length, (string) $this->encoding());

        return new self($sub, $this->encoding);
    }
public function substring(int $start, int $length = null): self
    {
        if ($this->length() === 0) {
            return $this;
        }

        $sub = \mb_substr($this->value, $start, $length, (string) $this->encoding());

        return new self($sub, $this->encoding);
    }
public function substring ( int $ start , int $ length = null ) : self { if ( $ this -> length ( ) === 0 ) { return $ this ; } $ sub = \ mb_substr ( $ this -> value , $ start , $ length , ( string ) $ this -> encoding ( ) ) ; return new self ( $ sub , $ this -> encoding ) ; }
Return part of the string

@param int $start
@param int $length

@return self
Return part of the string