AppendBool in Go

Posted by GoDoc
Public (Editable by Users)

AppendBool appends "true" or "false", according to the value of b, to dst and returns the extended buffer.

Go
Edit
package main

import (
	"fmt"
	"strconv"
)

func main() {
	b := []byte("bool:")
	b = strconv.AppendBool(b, true)
	fmt.Println(string(b))
}