Gaaker Go

Golang Escaped characters

The escape characters of the string are:

Newline character (\n)
Means line break
Carriage return (\r)
Represents a carriage return
Tab character (\t)
Represents a tab character, which can usually be used for typesetting.
Unicode characters (\u or \U)
Represents Unicode characters, such as \u0067
Backslash itself (\)
Where you need to output a backslash, add a backslash before the backslash to output the backslash itself.

The following is a complete code example.

package main

import "fmt"

func main() {
    fmt.Println("String\t")
    fmt.Println("is a value type,\nand the value\t is immutable.")
    fmt.Println("\u0067\u006f")
}

Below is the program output:

String
is a value type,
and the value    is immutable.
go
< Escaped characters Escaped characters >