数组和切片

  • 判断某个对象是否在切片中
obj := 3
target := []int{3,4,5}

if arr.InArray(obj, target) {
    // put your code here
}

obj2 := "go"
target2 := []string{"go","python","php"}

if arr.InArray(obj2, target2){
    // put your code here
}

results matching ""

    No results matching ""