Contact: aviboots(AT)netvision.net.il
31,166 questions
40,722 answers
573 users
package main import ( "fmt" "bytes" ) func main() { slice := []byte{'G', 'O', ' ' , '1', '.', 'a', '1', '4', '.', 'a', '2'} index := bytes.Index(slice, []byte("a")) fmt.Printf("%d", index) } /* run: 5 */
package main import ( "fmt" "bytes" ) func main() { index := bytes.Index([]byte("axbccdbdbefbbxyz"),[]byte("b")) fmt.Printf("%d", index) } /* run: 2 */