MCPcopy Create free account
hub / github.com/docker/cli / stringSliceIndex

Function stringSliceIndex

cmd/docker/aliases_utils.go:3–18  ·  view source on GitHub ↗
(s, subs []string)

Source from the content-addressed store, hash-verified

1package main
2
3func 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.

Callers 1

stringSliceReplaceAtFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…