Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import (
- "fmt"
- )
- func main() {
- b1 := []byte("hello")
- b2 := b1[:0]
- b2 = append(b2, []byte("shanexu")...)
- fmt.Println(string(b1))
- x1 := []byte{'h', 'e', 'l', 'l', 'o'}
- x2 := x1[:0]
- x2 = append(x2, []byte("shanexu")...)
- fmt.Println(string(x1))
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement