src/Viserio/Component/Support/Str.php
private static function replaceByPosition(string $subject, string $replace, $position, string $search): string
    {
        if ($position !== false) {
            return \substr_replace($subject, $replace, $position, \mb_strlen($search));
        }

        return $subject;
    }
private static function replaceByPosition(string $subject, string $replace, $position, string $search): string
    {
        if ($position !== false) {
            return \substr_replace($subject, $replace, $position, \mb_strlen($search));
        }

        return $subject;
    }
Helper function for replaceLast and replaceFirst.

@param string   $subject
@param string   $replace
@param bool|int $position
@param string   $search

@return string