github.com/XiaoMi/Gaea@v1.2.5/util/array.go (about)

     1  package util
     2  
     3  func ArrayFindIndex(items []string, findItem string) int {
     4  	for index, item := range items {
     5  		if item == findItem {
     6  			return index
     7  		}
     8  	}
     9  	return -1
    10  }
    11  
    12  func ArrayRemoveItem(items []string, findItem string) []string {
    13  	newArray := make([]string, 0)
    14  	for _, item := range items {
    15  		if item == findItem {
    16  			continue
    17  		}
    18  		newArray = append(newArray, item)
    19  	}
    20  	return newArray
    21  }