Golang strconv.AppendInt() function example

package strconv

Golang strconv.AppendInt() function usage example

 package main

 import (
  "fmt"
  "strconv"
 )

 func main() {

  //func AppendInt(dst []byte, i int64, base int) []byte

  dst := []byte("Int is ")

  fmt.Println("Before : ", string(dst))

  b := strconv.AppendInt(dst, int64(2), 10)

  fmt.Println("After : ", string(b))

  b = strconv.AppendInt(dst, int64(23), 10)

  fmt.Println("After : ", string(b))
 }

Reference :

http://golang.org/pkg/strconv/#AppendInt

Advertisement