Splice the data and replace

@param integer $offset      Starting row to get
@param integer $length      How many rows to get
@param array   $replacement Optional! Replaced rows

@return DataStore New dataStore containing results.
513460
public function splice($offset, $length = null, $replacement = [])
    {
        if (func_num_args() == 1) {
            return new DataStore(
                array_splice($this->rows, $offset), 
                $this->metaData
            );
        }

        return new DataStore(
            array_splice($this->rows, $offset, $length, $replacement),
            $this->metaData
        );
    }
657771
public function replaceArray( string $search, array $replace ) : SplString
    {
        foreach( $replace as $value ){
            $this->setString( $this->replaceFirst( $search, $value ) );
        }
        return $this;
    }
680178
public function cut(int $offset, ?int $length = null): self
    {
        if (null === $length) {
            $length = PHP_INT_MAX;
        }
        if ($offset < 0) {
            $offset = $this->count() + $offset;
        }

        return $this->prune(
            function ($value, $key, $index) use ($offset, $length) {
                return ($index >= $offset) && ($index < $offset + $length);
            }
        );
    }
927863
public static function extract($string, $offset, $length = null) {
        if ($length) {
            return mb_substr($string, $offset, $length);
        }

        return mb_substr($string, $offset);
    }
531111
public function replace($column, $target, $replacement)
    {
        $this->queryBuilder->replace($column, $target, $replacement);
        return $this;
    }
390565
public function getSlice($offset, $length)
    {
        $list = array();
        foreach (parent::getSlice($offset, $length) as $hit) {
            $list[] = $hit->valueObject;
        }

        return $list;
    }
512403
public function keep(int $offset, ?int $length = null): self
    {
        $this->items = $this->slice($offset, $length)->toArray();

        return $this;
    }
937120
public function getSlice($offset, $length)
    {
        return $this->datasetFactory
            ->bookmarks()
            ->load($offset, $length)
            ->getBookmarks();
    }
268691
public function getSlice($offset, $length)
    {
        return $this->query->offset($offset)->limit($length)->get();
    }
357622
public function slice($offset, $length = null): CollectionInterface
    {
        if ($length < 0) {
            throw new InvalidArgumentException('Negative slice lengths are not supported');
        }

        $result = $this;
        if ($offset < 0) {
            $result = $this->take($offset);
        } elseif ($offset > 0) {
            $result = $this->offset($offset);
        }

        if ($length !== null) {
            $result = $result->take($length);
        }

        return $result;
    }
1158605
public function getSlice($offset, $length)
    {
        $this->response = $this->searcher->search($offset, $length);
        $this->processResponse($this->response);

        return $this->hits;
    }
566682
public function getSlice($offset, $length)
    {
        $this->resultSet = $this->searchable->search($this->query, array(
            'from' => $offset,
            'size' => $length
        ));

        return $this->convertResultSet($this->resultSet);
    }
856666
public function slice(int $offset, int $length = null):ByteArray{

		// keep an extended class
		/** @var \chillerlan\Traits\ArrayHelpers\ByteArray $slice */
		$slice  = (new ReflectionClass($this))->newInstanceArgs([$length ?? ($this->count() - $offset)]);

		foreach($slice as $i => $_){
			$slice[$i] = $this[$offset + $i];
		}

		return $slice;
	}
871733
public static function replaceStrict(array $source, array ...$replace) {

        $replacements = [];

        foreach ($replace as $items) {
            $replacements[] = array_intersect_key($items, $source);
        }

        return array_merge($source, ...$replacements);

    }
1369995
public function truncate($value, $length, $replace = '...')
    {
        if (!isset($value)) {
            return null;
        }
        
        return strlen($value) <= $length ? $value : substr($value, 0, $length - strlen($replace)) . $replace;
    }
1095455
public function slice($offset, $length = null)
    {
        return new DataStore(
            array_slice($this->rows, $offset, $length), 
            $this->metaData
        );
    }
1327548
public function limit($offset, $length = null)
    {
        if (is_null($length) && strpos($offset, ',')) {
            list($offset, $length) = explode(',', $offset);
        }

        $this->options['limit'] = intval($offset) . ($length ? ',' . intval($length) : '');

        return $this;
    }