(haystack string, needle string)
| 5 | } |
| 6 | |
| 7 | func strStr(haystack string, needle string) int { |
| 8 | if len(needle) == 0 { |
| 9 | return 0 |
| 10 | } |
| 11 | for ind := range haystack { |
| 12 | if len(haystack) < ind+len(needle) { |
| 13 | break |
| 14 | } |
| 15 | if haystack[ind:ind+len(needle)] == needle { |
| 16 | return ind |
| 17 | } |
| 18 | } |
| 19 | return -1 |
| 20 | } |
nothing calls this directly
no outgoing calls
no test coverage detected