Index of.

@param string $haystack
@param string $needle
@param int $offset
@return int
10014
public static function indexOf(string $haystack, string $needle, int $offset = 0): int
    {
        $pos = self::strpos($haystack, $needle, $offset);
        return is_int($pos) ? $pos : -1;
    }
266365
public static function endWith(string $haystack, string $needle): bool
    {
        return ($needle === mb_substr($haystack, -mb_strlen($needle, 'UTF-8'), null, 'UTF-8'));
    }
568917
public static function startWith(string $haystack, string $needle): bool
    {
        return ($needle === mb_substr($haystack, 0, mb_strlen($needle, 'UTF-8'), 'UTF-8'));
    }
1068980
public function strpos($haystack, $needle, $offset = 0)
    {
        return mb_strpos($haystack, $needle, $offset, $this->getEncoding());
    }
1312080
public static function has(string $needle, string $haystack): bool
    {
        return $needle === '' || strpos($haystack, $needle) !== false;
    }
27163
public static function strpos($haystack, $needle, $offset = null)
    {
        return mb_strpos($haystack, $needle, (int) $offset, static::ENC_UTF8);
    }
26891
public function exists($needle, $haystack = null)
    {
        $result = true;
        if ($haystack && $result && $haystack[0] != "00")
            $result = in_array($needle, $haystack);
        return $result;
    }
1305625
public static function endsWith($haystack, $needle)
    {
        return $needle == substr($haystack, strlen($haystack) - strlen($needle));
    }
1215055
function _findIndex(haystack, needle) {
            if (angular.isUndefined(haystack) || haystack.length === 0) {
                return -1;
            }

            for (var i = 0, len = haystack.length; i < len; i++) {
                if (haystack[i] === needle) {
                    return i;
                }
            }

            return -1;
        }
521361
private static int count(final String needle, final String haystack) {
        int count = 0;
        int pos = -1;
        while ((pos = haystack.indexOf(needle, pos + 1)) >= 0) {
            count++;
        }
        return count;
    }
263334
public static function Position ($haystack, $needle, $offset = 0, $encoding = Encoding::DEFAULT_ENCODING) {
		return mb_strpos($haystack, $needle, $offset, $encoding);
	}
1360988
public static function unsetInArrayByValue($needle, array $haystack, $reIndex = true)
    {
        $doReindex = false;

        foreach($haystack as $key => $value) {
            if (is_array($value)) {
                $haystack[$key] = static::unsetInArrayByValue($needle, $value);
            } else if ($needle === $value) {

                unset($haystack[$key]);

                if ($reIndex) {
                    $doReindex = true;
                }
            }
        }

        if ($doReindex) {
            $haystack = array_values($haystack);
        }

        return $haystack;
    }
828865
public function containsFilter($haystack, $needle)
    {
        if (empty($needle)) {
            return $haystack;
        }

        return (strpos($haystack, (string) $needle) !== false);
    }
1051470
public static function indexOf(string $haystack, string $needle, int $nth = 1): ?int
    {
        $pos = static::pos($haystack, $needle, $nth);

        return $pos === null
            ? null
            : \mb_strlen(\substr($haystack, 0, $pos));
    }
1201690
public static function targetSet($needle, $value, array $haystack = array())
    {
        $keys = explode('.', $needle);
        $loop = &$haystack;

        foreach ($keys as $key) {
            if (is_array($loop) === false) {
                $loop = array();
            }

            if (array_key_exists($key, $loop) === false) {
                $loop[$key] = array();
            }

            $loop = &$loop[$key];
        }

        $loop = $value;

        return $haystack;
    }
1233370
public static int indexOf(ByteBuf needle, ByteBuf haystack) {
        // TODO: maybe use Boyer Moore for efficiency.
        int attempts = haystack.readableBytes() - needle.readableBytes() + 1;
        for (int i = 0; i < attempts; i++) {
            if (equals(needle, needle.readerIndex(),
                       haystack, haystack.readerIndex() + i,
                       needle.readableBytes())) {
                return haystack.readerIndex() + i;
            }
        }
        return -1;
    }
842302
private static function arraySearch(string $needle, array $haystack): string
    {
        foreach ($haystack as $key => $value) {
            if ($needle === $value || (is_array($value) && self::arraySearch($needle, $value) !== '')) {
                return $key;
            }
        }

        return '';
    }