UnquoteChar in Go

Posted by GoDoc
Public (Editable by Users)

UnquoteChar decodes the first character or byte in the escaped string or character literal represented by the string s. It returns four values:

Go
Edit
package main

import (
	"fmt"
	"log"
	"strconv"
)

func main() {
	v, mb, t, err := strconv.UnquoteChar(`\"Fran & Freddie's Diner\"`, '"')
	if err != nil {
		log.Fatal(err)
	}

	fmt.Println("value:", string(v))
	fmt.Println("multibyte:", mb)
	fmt.Println("tail:", t)
}