Golang strconv.UnquoteChar() function example
package strconv
Golang strconv.UnquoteChar() function usage example
package main
import (
"fmt"
"strconv"
)
func main() {
// func UnquoteChar(s string, quote byte) (value rune, multibyte bool, tail string, err error)
text := "'t' - is an example rune"
rune, needmultibyte, tail, err := strconv.UnquoteChar(text[1:], text[0]) // quote byte text[0] = '
if err != nil {
fmt.Println(err)
}
fmt.Println("A unquoted char looks like :", rune)
fmt.Println("A unquoted char looks like :", string(rune))
fmt.Println("Need multibyte? :", needmultibyte)
fmt.Println("Tail : ", tail)
}
Reference :
Advertisement
Something interesting
Tutorials
+32.7k Golang : Regular Expression for alphanumeric and underscore
+14.5k Golang : Overwrite previous output with count down timer
+8.6k Golang : Progress bar with ∎ character
+7.1k Golang : Transform lisp or spinal case to Pascal case example
+22.7k Golang : Strings to lowercase and uppercase example
+9k Golang : Inject/embed Javascript before sending out to browser example
+4.4k Linux/MacOSX : Search and delete files by extension
+12k Golang : Decompress zlib file example
+8.8k Golang : Accept any number of function arguments with three dots(...)
+11k Golang : Generate random elements without repetition or duplicate
+26k Golang : Convert IP address string to long ( unsigned 32-bit integer )