@param string $string

@return bool
353949
public function startsWith(string $string) : bool
    {
        return substr($this->path, 0, strlen($string)) === $string;
    }
865299
public static function validate($string)
    {
        try {
            if (is_numeric($string) && (int)$string == $string) {
                $date = new DateTime('@' . $string);
            } else {
                $date = self::parse($string);
            }
        } catch (Exception $ex) {
            return false;
        }

        // String is empty or not a valid date
        if (empty($string) || $date === false) {
            return false;

            // String is a valid date
        } else {
            return true;
        }
    }
89605
protected function isSerialized($string)
    {
        // if it isn't a string, it isn't serialized
        if ( ! is_string($string)) {
            return false;
        }
        $string = trim($string);
        if ('N;' == $string) {
            return true;
        }
        if ( ! preg_match('/^([adObis]):/', $string, $matches)) {
            return false;
        }
        switch ($matches[ 1 ]) {
            case 'a' :
            case 'O' :
            case 's' :
                if (preg_match("/^{$matches[1]}:[0-9]+:.*[;}]\$/s", $string)) {
                    return true;
                }
                break;
            case 'b' :
            case 'i' :
            case 'd' :
                if (preg_match("/^{$matches[1]}:[0-9.E-]+;\$/", $string)) {
                    return true;
                }
                break;
        }

        return false;
    }
1282961
private function hasAttachedMethod($string)
    {
        return 1 === substr_count($string, self::M_SEPARATOR) && 0 !== strpos($string, self::M_SEPARATOR);
    }
1101263
public function contains($string): bool
    {
        try {
            Assert::typeOf(['string', __CLASS__], $string);
        } catch (InvalidArgumentException|TypeError $t) {
            return false;
        }

        return mb_strpos($this->data, (string) $string, 0, $this->encoding) !== false;
    }
1164094
protected function parseString($string) {
        $matches = [];

        if (preg_match_all($this->regex, $string, $result) !== false) {
            $matches = $result[0];
        }

        return $matches;
    }
893365
public static function checkUtf8Encoding($string)
    {
        if (!mb_check_encoding($string, 'UTF-8') ||
            !$string == mb_convert_encoding(mb_convert_encoding($string, 'UTF-32', 'UTF-8'), 'UTF-8', 'UTF-32')
        ) {
            return false;
        }

        return true;
    }
815556
public static function decode(string $string)
    {
        $content = json_decode($string, true);

        self::throwOnError();

        return $content;
    }
1082654
public static function isXml($string = '')
    {
        if ($string === '') {
            return false;
        }

        $xml_parser = xml_parser_create();
        if (!xml_parse($xml_parser, $string, true)) {
            xml_parser_free($xml_parser);
            return false;
        }

        return true;
    }
882513
public static function isValid($string)
    {
        if (is_int($string) || is_float($string)) {
            return true;
        }

        json_decode($string);

        return json_last_error() === JSON_ERROR_NONE;
    }
1326120
public function detectEnvironment($string) {
        if ($this->matchIgnoreRules($string)) {
            return false;
        }

        if ($env = $this->matchEnvironmentRules($string)) {
            return $env;
        }

        return null;
    }
1327479
protected function isSoftBool($string)
    {
        if (!is_scalar($string) || $string === null) {
            return false;
        }
        
        $string = (string) $string;
        
        return $string == '0' || $string == '1';
    }
691683
public function isGlobbed($string)
    {
        $segments = $this->parser->parse($string);
        foreach ($segments as $segment) {
            // if bitmask contains pattern
            if ($segment[1] & SelectorParser::T_PATTERN) {
                return true;
            }
        }

        return false;
    }
256815
private function isJsonString($string)
    {
        if (! is_string($string)) {
            return false;
        }
        
        $firstChar = substr($string, 0, 1);
        
        // If it starts the way a JSON object or array would, and parsing it as
        // JSON returns no errors, consider it a JSON string.
        if (($firstChar === '{') || ($firstChar === '[')) {
            json_decode($string);
            return (json_last_error() == JSON_ERROR_NONE);
        }
        
        return false;
    }
851546
public static function isJson($string)
    {
        if (strpos($string, "{") !== false) {
            json_decode($string);
            return (json_last_error() == JSON_ERROR_NONE);
        } else {
            return false;
        }
    }
966845
public static function stringToValue($string)
	{
		if($string == '')
		{
			return $string;
		}
		if(is_float($string))
		{
			return (float) $string;
		}
		if(is_int($string))
		{
			return (int) $string;
		}
		if(strtolower($string) == 'true')
		{
			return true;
		}
		if(strtolower($string) == 'false')
		{
			return false;
		}
		if(strtolower($string) == 'null')
		{
			return NULL;
		}
		
		return $string;
	}
697443
public static function getBoolean($string) {
    $val = filter_var($string, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE);
    if ($val === null) {
      return $string;
    }
    return $val;
  }