Golang strconv.AppendQuote() function example

package strconv

Golang strconv.AppendQuote() function usage example.

 package main

 import (
  "fmt"
  "strconv"
 )

 func main() {

  //func AppendQuote(dst []byte, s string) []byte

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

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

  b := strconv.AppendQuote(dst, "this")

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

  b = strconv.AppendQuote(dst, "that")

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

Output :

Before : String is

After : String is "this"

After : String is "that"

Reference :

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

Advertisement