Ensure the string starts with a given value

@param string $ensure Value to ensure the string ends with

@return $this
548748
public function ensureEndsWith(string $ensure): Utility
    {
        if (!$this->endsWith($ensure)) {
            return $this->append($ensure);
        }

        return $this;
    }
244738
public function start( string $prefix ) : SplString
    {
        $quoted = preg_quote( $prefix, '/' );
        return $this->setString( $prefix.preg_replace( '/^(?:'.$quoted.')+/u', '', $this->__toString() ) );
    }
497960
public static function start($value, $prefix)
    {
        $quoted = preg_quote($prefix, '/');

        return $prefix.preg_replace('/^(?:'.$quoted.')+/u', '', $value);
    }
234521
public function createdAt($start = null, $end = null)
    {
        /* @var $this ActiveQuery */
        $model = $this->noInitModel;
        if (!is_string($model->createdAtAttribute) || empty($model->createdAtAttribute)) {
            return $this;
        }
        return static::range($this, $model->createdAtAttribute, $start, $end);
    }
365905
protected function validate(&$value)
    {
        if ($this->isString($value) && $this->isNumber($value)) {
            if (!$this->str($value)->contains('.') && !$this->str($value)->contains(',')) {
                $value = intval($value);
            }
        }

        if (!$this->isInteger($value)) {
            $this->expected('integer', gettype($value));
        }

        parent::validate($value);

        return $this;
    }
629885
public function startsWith($prefix)
    {
        if (\is_array($prefix)) {
            /** @noinspection ForeachSourceInspection */
            foreach ($prefix as $item) {
                $this->startsWith($item);
            }
        } else {
            $this->assertNotBlanks($prefix);
            $this->predicates[] = $this->processValue($prefix) . '*';
        }

        return $this;
    }
488130
public static function ensureRight($string, $search, $encoding = null)
    {
        if (static::endsWith($string, $search, true, $encoding)) {
            return $string;
        }

        return $string . $search;
    }
1070491
public function setEnvironment(string $environment): Bootstrap
    {
        Environment::validateEnvironment($environment);
        $this->environment = $environment;

        return $this;
    }
306203
public function setHelp($help)
    {
        if (null !== $help) {
            Assert::string($help, 'The help text must be a string. Got: %s');
            Assert::notEmpty($help, 'The help text must not be empty.');
        }

        $this->help = $help;

        return $this;
    }
1289240
public function startsWith($str, $msg)
    {
        if(strlen($this->_value) > 0 && substr($this->_value, 0, strlen($str)) !== $str) {
            $this->_errors[] = $msg;
        }
        return $this;
    }
1138986
public function replace() {

		if(null !== $this -> match) {

			foreach($this -> match[0] as $index => $match) {

				$code = '<?php endforeach; ?>';
				$this -> line = preg_replace('/' . preg_quote($this -> match[0][$index], '/') . '/', $code, $this -> line , 1);
			}
		}

		return $this;
	}
498676
public function startsWith($word, $identical = false)
    {
        $this->addCondition(__METHOD__, [$word, $identical]);

        return $this;
    }
226138
public function assert(string $key, string $regex): self
    {
        return $this->setRequirement($key, $regex);
    }
1070056
public function setRequirement($key, $regex)
    {
        $this->requirements[$key] = $this->sanitizeRequirement($key, $regex);
        $this->compiled = null;

        return $this;
    }
43731
public static function startsWith($string, $target, $caseSensitive = true)
    {
        if (!$caseSensitive) {
            $string = strtolower($string);
            $target = strtolower($target);
        }

        return strpos($string, $target) === 0;
    }
280286
function ireplaceF ($search, $replace)
	{
		ensure('Search argument',  $search,  'is_a_string', __CLASS__, __METHOD__);
		ensure('Replace argument', $replace, 'is_a_string', __CLASS__, __METHOD__);

		$this->string = str_ireplace($search, $replace, $this);

		return $this;
	}
134402
public function start(string $key)
    {
        $filteredKey = $this->filterKey($key);
        $value = $this->get($filteredKey);
        if ($value === null) {
            $this->lastKey = $filteredKey;
            ob_start();
        } else {
            $this->lastKey = null;
            trigger_error('Cache start failed');
        }
        return $this;
    }