(s, subs []string)
| 1 | package main |
| 2 | |
| 3 | func stringSliceIndex(s, subs []string) int { |
| 4 | j := 0 |
| 5 | if len(subs) > 0 { |
| 6 | for i, x := range s { |
| 7 | if j < len(subs) && subs[j] == x { |
| 8 | j++ |
| 9 | } else { |
| 10 | j = 0 |
| 11 | } |
| 12 | if len(subs) == j { |
| 13 | return i + 1 - j |
| 14 | } |
| 15 | } |
| 16 | } |
| 17 | return -1 |
| 18 | } |
| 19 | |
| 20 | // stringSliceReplaceAt replaces the sub-slice find, with the sub-slice replace, in the string |
| 21 | // slice s, returning a new slice and a boolean indicating if the replacement happened. |
no outgoing calls
no test coverage detected
searching dependent graphs…