Every line of 'golang remove from array' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Go code is secure.
173 func remove(array []exchange.Order, i int) []exchange.Order { 174 if len(array) == 1 { 175 return array[:0] 176 } else if len(array) < 1 { 177 return array 178 } 179 180 array[len(array)-1], array[i] = array[i], array[len(array)-1] 181 return array[:len(array)-1] 182 }
64 func del(arr []string, s string) (narr []string) { 65 narr = []string{} 66 for i, item := range arr { 67 if item != s { 68 narr = append(narr, item) 69 } else { 70 narr = append(narr, arr[i+1:]...) 71 break 72 } 73 } 74 return 75 }
555 func removeElem(array []string, elem string) []string { 556 ret := make([]string, 0) 557 for _, s := range array { 558 if s != elem { 559 ret = append(ret, s) 560 } 561 } 562 return ret 563 }
55 func deleteElementInt(arr []int, i int) []int { 56 retval := make([]int, i) 57 copy(retval, arr[:i]) 58 retval = append(retval, arr[i+1:]...) 59 return retval 60 }
33 func RemoveString(array []string, index int) []string { 34 return append(array[:index], array[index+1:]...) 35 }
18 func RemoveFromTaskArray(arr []*Task, ndx int) []*Task { 19 if ndx < 0 || ndx >= len(arr) { 20 return arr 21 } 22 return append(arr[0:ndx], arr[ndx+1:]...) 23 }
40 func Remove(l *list.List, value interface{}) { 41 var e *list.Element 42 43 for iter := l.Front(); iter != nil; iter = iter.Next() { 44 if iter.Value == value { 45 e = iter 46 break 47 } 48 } 49 50 if nil != e { 51 l.Remove(e) 52 } 53 }
128 func RemoveRepeatedElement(arr []string) (newArr []string) { 129 newArr = make([]string, 0) 130 for i := 0; i < len(arr); i++ { 131 repeat := false 132 for j := i + 1; j < len(arr); j++ { 133 if arr[i] == arr[j] { 134 repeat = true 135 break 136 } 137 } 138 if !repeat { 139 newArr = append(newArr, arr[i]) 140 } 141 } 142 return newArr 143 }
51 func remove(slice []string, i int) []string { 52 return append(slice[:i], slice[i+1:]...) 53 }
18 func removeElement(nums []int, val int) int { 19 index := 0 20 21 for _, n := range nums { 22 if n != val { 23 nums[index] = n 24 index++ 25 } 26 } 27 28 return index 29 }