Pattern Index
STRING

Problem

Return the index at which the substring t first appears in the string s, or -1 if it is not found.

Examples

findSubstring("stripenetwave", "net") // returns 6 // "net" first appears "stripenetwave". findSubstring("wavecirclestripe", "ball") // returns -1 // "ball" is not found in "wavecirclestripe".
Loading...