src/Text.php
public function splice($replacement, $offset, $length = null) {
		$offset = $this->prepareOffset($offset);
		$length = $this->prepareLength($offset, $length);

		$start = $this->substring(0, $offset);
		$end = $this->substring($offset + $length);

		return new Text($start . $replacement . $end);
	}
public function splice($replacement, $offset, $length = null) {
		$offset = $this->prepareOffset($offset);
		$length = $this->prepareLength($offset, $length);

		$start = $this->substring(0, $offset);
		$end = $this->substring($offset + $length);

		return new Text($start . $replacement . $end);
	}
public function splice ( $ replacement , $ offset , $ length = null ) { $ offset = $ this -> prepareOffset ( $ offset ) ; $ length = $ this -> prepareLength ( $ offset , $ length ) ; $ start = $ this -> substring ( 0 , $ offset ) ; $ end = $ this -> substring ( $ offset + $ length ) ; return new Text ( $ start . $ replacement . $ end ) ; }
Replace text within a portion of a string.

@param string|Text $replacement
@param int $offset
@param int|null $length
@return Text
@throws \InvalidArgumentException If $offset is greater then the string length or $length is too small.
Replace text within a portion of a string .