Golang strconv.AppendQuoteRune() and AppendQuoteRuneToASCII() functions example

package strconv

Golang strconv.AppendQuoteRune() and AppendQuoteRuneToASCII() functions usage example

 package main

 import (
  "fmt"
  "strconv"
 )

 func main() {

  //func AppendQuoteRune(dst []byte, r rune) []byte

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

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

  b := strconv.AppendQuoteRune(dst, 't') // replace double quote with single quote for rune

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

  b = strconv.AppendQuoteRuneToASCII(dst, '다')

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

References :

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

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

Advertisement