Checks if value starts with a search string

@param mixed  $value    The value
@param string $search   The search string
@param string $encoding The string encoding

@return bool
767074
public static function startsWith($value, string $search, string $encoding = 'UTF-8'): bool
    {
        if (!static::isStringCastable($value)) {
            return false;
        }

        $searchlen = (int) mb_strlen($search, $encoding);
        $start = mb_substr((string) $value, 0, $searchlen, $encoding);

        return $search === $start;
    }
1143622
public function starts_with( $haystack, $needle ) {
		if ( '' === $haystack || '' === $needle ) {
			return false;
		}
		if ( $haystack === $needle ) {
			return true;
		}

		return strncmp( $haystack, $needle, strlen( $needle ) ) === 0;
	}
525507
public function startsWith($string, int $offset = 0): bool
    {
        try {
            Assert::typeOf(['string', __CLASS__], $string);
        } catch (InvalidArgumentException|TypeError $t) {
            return false;
        }

        return mb_strpos($this->data, (string) $string, $offset, $this->encoding) === 0;
    }
1009690
public static function between(
        $string,
        $start,
        $end,
        $offset = 0,
        $encoding = null
    ) {
        $encoding = $encoding === null ? mb_internal_encoding() : $encoding;

        $startIndex = Mbstring::strpos($string, $start, $offset, $encoding);

        if ($startIndex === false) {
            return '';
        }

        $substrIndex = $startIndex + Mbstring::strlen($start, $encoding);

        $endIndex = Mbstring::strpos($string, $end, $substrIndex, $encoding);

        if ($endIndex === false) {
            return '';
        }

        return Mbstring::substr($string, $substrIndex, $endIndex - $substrIndex);
    }
1117028
public function startsWith($string)
    {
        $string = StdObjectWrapper::toString($string);

        $position = $this->stringPosition($string);
        if ($position !== false && $position == 0) {
            return true;
        }

        return false;
    }
1247574
def startswith(self, key, value):
        
        value = value if isinstance(value, six.text_type) else value.decode('utf-8')
        self._add_condition(key, '$regex', '^' + self._quote(value))
        return self
310288
final public function doIndex($start = 0, $len = 30, $search = null)
    {
        //SEarch
        if ($search !== null && is_array($search)) {
            $tmp = ' WHERE ';
            $and = '';
            foreach ($search as $k => $v) {
                $tmp .= $and.$k.' LIKE "%'.$v.'%" ';
                $and = ' AND ';
            }
            $search = $tmp;
        } else {
            $search = '';
        }

        //Execute
        $this->db->query('SELECT * FROM '.$this->table.$search.' LIMIT '.(0+$start).', '.(0+$len));
        return $this->db->result();
    }
202090
public function checkChars($value)
    {
        if (strlen($value) != 8) {
            if (strpos($value, 'X') !== false) {
                return false;
            }
        }

        return parent::checkChars($value);
    }
625878
public function startsWith($str)
    {
        self::mustBeString($str, 'Searched starting string');

        $str = preg_quote($str, '/');

        return (boolean) preg_match("/^$str/", $this->value);
    }
111756
public static function startsWith($haystack, $needle)
    {
        return $needle === '' or mb_strrpos($haystack, $needle, -mb_strlen($haystack)) !== false;
    }
826421
static public function contains($string, $needle, $message = null, $propertyPath = null, $encoding = 'utf8')
        {
            static::string($string);

            if (mb_strpos($string, $needle, null, $encoding) === false) {
                $message = $message ?: sprintf(
                    'Value "%s" does not contain "%s".',
                    static::stringify($string),
                    static::stringify($needle)
                );

                $constraints = array('needle' => $needle, 'encoding' => $encoding);

                throw static::createException($string, $message, static::INVALID_STRING_CONTAINS, $propertyPath, $constraints);
            }
        }
649501
public static function startsWith($haystack, $needle)
    {
        if (strlen($haystack) < strlen($needle)) {
            return false;
        }
        $start = substr($haystack, 0, strlen($needle));

        return $needle === "" || $needle === $start;
    }
294260
protected function match($operator, $pattern, $value)
    {
        $value   = strtolower($value);
        $pattern = strtolower($pattern);
        switch ($operator) {
            case '=':
                return $value === $pattern;
            case '!=':
                return $value !== $pattern;
            case '^=':
                return preg_match('/^'.preg_quote($pattern, '/').'/', $value);
            case '$=':
                return preg_match('/'.preg_quote($pattern, '/').'$/', $value);
            case '*=':
                if ($pattern[0] == '/') {
                    return preg_match($pattern, $value);
                }

                return preg_match("/".$pattern."/i", $value);
        }

        return false;
    }
521019
protected function startsWith($value, $line = null)
    {
        if (is_null($line)) {
            $line = $this->currentLine();
        }

        return (substr($line, 0, strlen($value)) === $value);
    }
429604
public static function startsWith($check, $string)
    {
        if ($check === "" || $check === $string) {
            return true;
        } else {
            return strpos($string, $check) === 0;
        }
    }
1190199
private function _match($key, $value, $filter)
    {
        if ($this->scanKeys) {
            if ($filter->match($key)) {
                return true;
            }
        }

        if ($filter->match($value)) {
            return true;
        }

        return false;
    }
1182052
protected function startsWithZeros($value) {
		$value = strval($value);
		if (strlen($value)>1 && strpos($value,'0')===0 && strpos($value,'0.')!==0) {
			return true;
		}
		else {
			return false;
		}
	}