tests if a string starts with a given string

@param $check
@param $string

@return bool
429604
public static function startsWith($check, $string)
    {
        if ($check === "" || $check === $string) {
            return true;
        } else {
            return strpos($string, $check) === 0;
        }
    }
802740
public static function startsWith($string, $substrings)
    {
        if (is_array($substrings)) {
            foreach ((array) $substrings as $substring) {
                if ($substring != '' && mb_strpos($string, $substring) === 0) {
                    return true;
                }
            }
        } elseif (is_string($substrings)) {
            if ($substrings != '' && mb_strpos($string, $substrings) === 0) {
                return true;
            }
        }

        return false;
    }
627072
public static function ensure_start_with($string, $leading_string)
    {
        if (StringTool :: start_with($string, $leading_string))
        {
            return $string;
        }
        else
        {
            return $leading_string . $string;
        }
    }
928984
private function hasValue(array $check, string $value): bool
    {
        if (empty($check[$value])) {
            return false;
        }

        return true;
    }
580859
protected function check(string $name, string $check = ''): bool
    {
        return Arr::get($this->keyMap, "{$name}.checksum") === $this->generateNewChecksum($check);
    }
1130520
public static function match(string $str, string $start, string $end) {
		$start = preg_quote($start);
		$end = preg_quote($end);
		if (preg_match('/' . $start . '(.*)' . $end . '/', $str, $matches)) {
			return $matches[1] . '';
		}
		return false;
	}
455506
public static boolean startsWith(String str, char prefix) {
	return str != null && str.length() > 0 && str.charAt(0) == prefix;
    }
1055985
public static function valueExistsOne($check, array $sampleArr): bool
    {
        // 以逗号分隔的会被拆开，组成数组
        if (\is_string($check)) {
            $check = \trim($check, ', ');
            $check = \strpos($check, ',') !== false ? explode(',', $check) : [$check];
        }

        return (bool)\array_intersect((array)$check, $sampleArr);
    }
1121995
protected static boolean startsWithIgnoreCase(String string, String prefix) {
        if (string == null || prefix == null) {
            return string == null && prefix == null;
        }
        if (prefix.length() > string.length()) {
            return false;
        }

        return string.regionMatches(true, 0, prefix, 0, prefix.length());
    }
640403
public static function getNextWhitespace($string, $start = -1)
    {
        while ($start < (strlen($string) - 1) && !self::isWhitespace($string[$start + 1])) {
            $start++;
        }

        if ($start === (strlen($string) - 1)) {
            return false;
        }

        $start++;

        return $start;
    }
175021
public static boolean startWith(@Nullable CharSequence s, char c) {
		if (StringUtils.isEmpty(s)) {
			return false;
		}
		return s.charAt(0) == c;
	}
1029252
private static boolean isStartWith(String testString, String[] targetStrings) {
        for (String s : targetStrings) {
            if (testString.startsWith(s)) {
                return true;
            }
        }

        return false;
    }
1285782
public static function startsWith($haystack, $needle) {
		if($needle === null && $haystack === null)
			return false;
		if($needle === null && $haystack !== null)
			return true;
		return $needle === "" || strrpos($haystack, $needle, -strlen($haystack)) !== false;
	}
43731
public static function startsWith($string, $target, $caseSensitive = true)
    {
        if (!$caseSensitive) {
            $string = strtolower($string);
            $target = strtolower($target);
        }

        return strpos($string, $target) === 0;
    }
669071
public static function startsWith(string $base, string $starts) : bool
    {
        if(
            $starts === "" ||
            strrpos($base, $starts, -strlen($base)) !== false
        ) {
            return true;
        }

        return false;
    }
823040
public function matches(string $string) : bool
    {
        $matches = [];

        return (bool)call_user_func_array(
            $this->_method,
            [
                sprintf("/%s/%s", $this->_expr, $this->_flags),
                $string,
                &$matches,
                $this->_pregMatchFlags ?: null,
            ]
        );
    }
1112811
public static function startsWith(string $string, $values): bool
    {
        foreach ((array) $values as $value) {
            if (!strncmp($string, $value, strlen($value))) {
                return true;
            }
        }

        return false;
    }