Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to put a backquote in a backquoted string?

Tags:

is it possible to print back quotes in Go using back quotes : something like this:

package main  import "fmt"  func main() {     fmt.Println(```) // for example I can do it with double quotes "\"" } 
like image 285
rookie Avatar asked Dec 12 '10 20:12

rookie


People also ask

How do you write a Backtick variable?

Note: we can easily use single quotes ( ' ) and double quotes ( " ) inside the backticks ( ` ). Example: To interpolate the variables or expression we can use the ${expression} notation for that. Multi-line strings means that you no longer have to use \n for new lines anymore.

How do you use a Backtick?

To create a back quote using a U.S. keyboard, press the ` , which is located directly below the Esc key. This key is also used for typing the tilde ( ~ ) character if the Shift key is held while it is pressed.

What is `` in JS?

Although single quotes and double quotes are the most popular, we have a 3rd option called Backticks ( `` ). Backticks are an ES6 feature that allows you to create strings in JavaScript. Although backticks are mostly used for HTML or code embedding purposes, they also act similar to single and double quotes.

What is Backtick character?

The character was designed for typewriters to add a grave accent to a (lower-case) base letter, by overtyping it atop that letter.


2 Answers

package main  import "fmt"  func main() {     // back ` quote     fmt.Println((`back ` + "`" + ` quote`)) } 

Raw string literals are character sequences between back quotes ``. Within the quotes, any character is legal except back quote. The value of a raw string literal is the string composed of the uninterpreted characters between the quotes; in particular, backslashes have no special meaning and the string may span multiple lines. String literals

like image 66
peterSO Avatar answered Sep 22 '22 18:09

peterSO


TLDR

fmt.Println("\x60") 

\x: Hex see fmt

6016 9610 1408 matches the character ` grave accent


Go Playground

like image 24
Carson Avatar answered Sep 21 '22 18:09

Carson