@param string $string
@param string $stringToSearch

@return bool
543432
protected function stringEndsWith($string, $stringToSearch)
    {
        return (substr($string, strlen($string) - strlen($stringToSearch)) === $stringToSearch);
    }
1112711
public function arrayMultiSearch($needle, $haystack) {
        foreach ($haystack as $key => $data) {
            if (in_array($needle, $data)) {
                return $key;
            }
        }
        return false;
    }
1077998
public function setSelectorTokenString(string $string)
    {
        if (strpos($string, ':') === false) {
            Throw new TokenException('AuthToken: The key is no valid selector:token string.');
        }
        $this->string = urldecode($string);

        $parts = explode(':', $this->string);

        $this->selector = $parts[0];
        $this->activation_token = $parts[1];
    }
969793
public function findCacheByString(string $string)
    {

        // Check if already in cache
        if (!$this->isCachedByString($string)) {
            return null;
        }

        return $this->cacheByString[$string];
    }
58208
public static function startsWithAny(string $searchString, array $prefixOptions, &$found = null): bool
    {
        foreach ($prefixOptions as $prefix) {
            if (self::startsWith($searchString, $prefix)) {
                $found = $prefix;
                return true;
            }
        }
        
        return false;
    }
160032
public static function stringStartsWith($haystack, $needle)
    {
        if (!is_string($haystack) || !is_string($needle)) {
            throw new \InvalidArgumentException('Not a string');
        }

        return strpos($haystack, $needle) === 0;
    }
630345
public static function contains( $needle, $haystack, $strict = false )
    {
        foreach ( $haystack as $_index => $_value )
        {
            if ( is_string( $_value ) )
            {
                if ( 0 === strcasecmp( $needle, $_value ) )
                {
                    return true;
                }
            }
            else if ( in_array( $needle, $_value, $strict ) )
            {
                return true;
            }
        }

        return false;
    }
30114
public static function indexOf($string, $needle, $strict = true, $offset = 0) {
        if ($strict) {
            return mb_strpos($string, $needle, $offset);
        }

        return mb_stripos($string, $needle, $offset);
    }
1196539
public function loadString($string)
    {
        $this->string = htmlspecialchars_decode($string);

        if ($this->config[ 'allowPhpScripts' ] === false) {
            $this->string = preg_replace(
                '/<\\?.*(\\?>|$)/Us',
                '',
                str_replace('<?=', '<?php echo ', $this->string)
            );
        }

        return (bool)empty($this->string);
    }
1348605
public static function compareBaseStrings($string1, $string2)
    {
    	if ( $string1 == $string2 ) return true;

    	$out2 = "";
    	$out1 = "";
        $chars = 0;
    	$oops = false;
        for($i=0; $i<strlen($string1)&&$i<strlen($string2); $i++) {
    		if ( $oops || $string1[$i] == $string2[$i] ) {
    			$out1 = $out1 . $string1[$i];
    			$out2 = $out2 . $string2[$i];
    		} else {
    			$out1 = $out1 . ' ->' . $string1[$i] .'<- ';
    			$out2 = $out2 . ' ->' . $string2[$i] .'<- ';
    			$oops = true;
    		}
    		$chars = $chars + 1;
    		if ( $chars > 79 ) {
    			$out1 .= "\n";
    			$out2 .= "\n";
    			$chars = 0;
    		}
    	}
    	if ( $i < strlen($string1) ) {
    		$out2 = $out2 . ' -> truncated ';
    		for($i=0; $i<strlen($string1); $i++) {
    			$out1 = $out1 . $string1[$i];
    			$chars = $chars + 1;
    			if ( $chars > 79 ) {
    				$out1 .= "\n";
    				$chars = 0;
    			}
    		}
    	}

    	if ( $i < strlen($string2) ) {
    		$out1 = $out1 . ' -> truncated ';
    		for($i=0; $i<strlen($string2); $i++) {
    			$out2 = $out2 . $string2[$i];
    			$chars = $chars + 2;
    			if ( $chars > 79 ) {
    				$out2 .= "\n";
    				$chars = 0;
    			}
    		}
    	}
    	return $out1 . "\n-------------\n" . $out2 . "\n";
    }
286524
public static function hasHtml($string, &$matches = array(), $ifAll = false) {
		return 0 < self::validateByRegExp('/<(.*)>.*|<(.*)\/>/', $string, $matches, $ifAll);
	}
668763
public static function containsValidJSON($string)
	{
		try
		{
			$result = json_decode($string);
		}
		catch(\Exception $e)
		{}
		
		if(self::getJSONError() === NULL)
			return true;
		else
			return false;
	}
353949
public function startsWith(string $string) : bool
    {
        return substr($this->path, 0, strlen($string)) === $string;
    }
1056355
public function lastIndexOf($string, $offset = 0)
	{
		ArgumentValidator::validateScalar($string);
		ArgumentValidator::validateEmpty($string);
		ArgumentValidator::validateUnsignedInteger($offset);
		$index = mb_strrpos($this->string, (string)$string, -1 * $offset);
		return $index === false ? null : $index;
	}
1003507
public static function contains(string $haystack, string $needle, int $offset = 0): bool
    {
        return self::strpos($haystack, $needle, $offset) !== false;
    }
301996
public static function regexContains($string, $find)
    {
        if (is_array($find)) {
            foreach ($find as $part) {
                if (preg_match($part, $string)) {
                    return true;
                }
            }

            return false;
        } else {
            return (preg_match($find, $string));
        }
    }
279347
private function searchByString($searchString, $rootClass, $offset, $limit)
    {
        /** @var Search $searchService */
        $searchService = $this->getServiceLocator()->get(Search::SERVICE_ID);
        /** @var ResultSet $result */
        $result = $searchService->query($searchString, $rootClass, $offset, $limit);
        $count = $result->getTotalCount();
        return $this->format($result, $count, $offset, $limit);
    }