Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Printing " (double quote) in GoLang

Tags:

string

go

quote

I am writing a Go code which reads from a file. To do so I use fmt.Println() to print into that intermediate file.

How can I print "?

like image 953
bender Avatar asked Jan 31 '17 09:01

bender


People also ask

How to print a string variable in Golang?

To print a string in Golang we have to use the package fmt which contains the input/output functions. The correct specifier tells the data type of variable we are printing. The specifiers we can use to print the strings are: %s − By using this we can print the uninterpreted strings or slice.

How do I remove single quotes from a string in Golang?

In your go source files, if you try to use single quotes for a multi-character string literal, you'll get a compiler error similar to illegal rune literal . What you can do instead for removing quotes from the start and end of a string, is use the strings. Trim function to take care of it.

What is Backtick Golang?

Backtick strings are analogues of any multiline raw string within Python or else Scala: r""" text""" or within JavaScript: String. raw`Hello\u000A!` They are useful: For keeping huge text inside. For regular expressions, while you own many of backslashes.


1 Answers

This is very easy, Just like C.

fmt.Println("\"") 
like image 187
Sourabh Bhagat Avatar answered Sep 17 '22 08:09

Sourabh Bhagat