basic indexOf implementation