Standard library / strconv

strconv.CanBackquote()

Reports whether s can be represented unchanged in a single-line raw Go string literal. Backquotes and control characters other than tab prevent this. Expected stdout: 'true false\n'.

Formal Syntax & Structure

go syntaxgo
func CanBackquote(s string) bool

Parameters & Attributes

NameTypeDescription
sstringInput text to parse, inspect or quote.

Return Value

bool

Whether the input satisfies the documented predicate.

Working Example

Example Snippetgo
package main
import (  "fmt"  "strconv")
func main() {  fmt.Println(strconv.CanBackquote("path/name"), strconv.CanBackquote("a\nb"))}
Go Reference