Standard library / strconv
strconv.UnquoteChar()
Decodes the first character or escape in s using the specified quote context; returns rune, multibyte flag, remaining string and error. The multibyte flag reports a multibyte UTF-8 character rather than a single decoded byte. Expected stdout: 'é true rest <nil>\n'.
Formal Syntax & Structure
go syntaxgo
func UnquoteChar(s string, quote byte) (value rune, multibyte bool, tail string, err error)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| s | string | Input text to parse, inspect or quote. |
| quote | byte | Literal quote context: single quote, double quote, or zero. |
Return Value
(value rune, multibyte bool, tail string, err error)
Decoded rune or byte, multibyte flag, remaining input, and syntax error if any.
Working Example
Example Snippetgo
package main
import ( "fmt" "strconv")
func main() { r, m, t, e := strconv.UnquoteChar(`\u00e9rest`, '"') fmt.Println(string(r), m, t, e)}