indexOf

Locates a substring or a character within a string, and returns the index of the first character, where 1 is the leading character of the string. If no match is found, 0 is returned.

Usage

Locate "needle" in the "haystack":

    number = indexOf(haystack, needle);

With constants, both string and character

    number = indexOf("abcde", "de");
    number = indexOf("abcde", 'd');