Advertisement
Guest User

Untitled

a guest
Feb 24th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.26 KB | None | 0 0
  1. package main
  2.  
  3. import (
  4. "fmt"
  5. )
  6.  
  7. func main() {
  8. b1 := []byte("hello")
  9. b2 := b1[:0]
  10. b2 = append(b2, []byte("shanexu")...)
  11. fmt.Println(string(b1))
  12.  
  13. x1 := []byte{'h', 'e', 'l', 'l', 'o'}
  14. x2 := x1[:0]
  15. x2 = append(x2, []byte("shanexu")...)
  16. fmt.Println(string(x1))
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement