IndexOfStr finds the index of a target string inside a slice of strings, return -1 if not found
(strs []string, target string)
| 17 | // IndexOfStr finds the index of a target string inside a slice of strings, |
| 18 | // return -1 if not found |
| 19 | func IndexOfStr(strs []string, target string) int { |
| 20 | for id, str := range strs { |
| 21 | if str == target { |
| 22 | return id |
| 23 | } |
| 24 | } |
| 25 | return -1 |
| 26 | } |
| 27 | |
| 28 | // IndexOfInt finds the index of a target int inside a slice of ints, |
| 29 | // return -1 if not found |
no outgoing calls
no test coverage detected