Here, We will see how to print backslash in strings in go. It is very easy to print something to the standard output in Go. You have to just import fmt
package and call Print(), Println() or Printf() function.
To print backslash in string, You just need to prepend one more backslash before to be printed backslash.
Go interpreter treats single backslash as escape sequence character. When you put two backslash then Go interpreter treats it as a single backslash character.
Example with code:
package main
import (
"fmt"
)
func main() {
fmt.Println("Hello \\ go")
fmt.Println("Hello \\\\ go")
fmt.Println("Hello \\\\\\ go")
}
Output:
Hello \ go
Hello \ go
Hello \\ go
To learn more about golang, Please refer given below link:
https://techieindoor.com/go-lang-tutorial/
References:
https://golang.org/doc/
https://golang.org/pkg/
I read this article fully on the topic of the resemblance of
most up-to-date and preceding technologies, it’s amazing article.
Thanks !!!
Hello, I believe your site might be having internet browser compatibility
issues. When I take a look at your website in Safari, it looks fine
however, if opening in Internet Explorer, it’s got some overlapping
issues. I just wanted to provide you with a quick
heads up! Apart from that, great website!
Thanks for sharing your feedback !!!
We will look into this..
This is my first time visit at here and i am genuinely happy to read all at single place.
Thanks for sharing your feedback !!!