public function slice($offset, $length = null) {
		$offset = $this->prepareOffset($offset);
		$length = $this->prepareLength($offset, $length);

		if ($length === 0) {
			return new Text('', $this->encoding);
		}

		return new Text(mb_substr($this->string, $offset, $length, $this->encoding), $this->encoding);
	}
public function slice($offset, $length = null) {
		$offset = $this->prepareOffset($offset);
		$length = $this->prepareLength($offset, $length);

		if ($length === 0) {
			return new Text('', $this->encoding);
		}

		return new Text(mb_substr($this->string, $offset, $length, $this->encoding), $this->encoding);
	}
public function slice ( $ offset , $ length = null ) { $ offset = $ this -> prepareOffset ( $ offset ) ; $ length = $ this -> prepareLength ( $ offset , $ length ) ; if ( $ length === 0 ) { return new Text ( '' , $ this -> encoding ) ; } return new Text ( mb_substr ( $ this -> string , $ offset , $ length , $ this -> encoding ) , $ this -> encoding ) ; }
Slices a piece of the string from a given offset with a specified length.
If no length is given, the String is sliced to its maximum length.

@see #substring
@param int $offset
@param int $length
@return Text
Slices a piece of the string from a given offset with a specified length . If no length is given the String is sliced to its maximum length .