Standard library / go/constant

go/constant.StringVal()

Extract unquoted string content; Unknown yields an empty string. Expected stdout: 'Go\n'.

Formal Syntax & Structure

go syntaxgo
func StringVal(x Value) string

Parameters & Attributes

NameTypeDescription
xValueInput constant or Go value as specified by the function.

Return Value

string

Extract unquoted string content; Unknown yields an empty string.

Working Example

Example Snippetgo
package main
import (  "fmt"  "go/constant")
func main() { fmt.Println(constant.StringVal(constant.MakeString("Go"))) }
Go Reference