packageescaptecharimport("fmt""testing")funcTestEscapteChar(t*testing.T){// \t制表符
fmt.Println("tom\tjack")//tom jack
// \n换行
fmt.Println("hello\nword")// \\
fmt.Println("c:\\Users\\Administrator\\Desktop\\Go语言")//c:\Users\Administrator\Desktop\Go语言
// \"
fmt.Println("Joker say \"Welcome to China!\"")// Joker say "Welcome to China!"
// \r回车,从当前行的最前面开始输出,覆盖掉以前的内容
fmt.Println("天龙八部雪山飞狐\r张飞")//张飞
}
1
2
3
4
5
6
7
8
=== RUN TestEscapteChar
tom jack
hello
word
c:\Users\Administrator\Desktop\Go语言
Joker say "Welcome to China!"
张飞
--- PASS: TestEscapteChar (0.00s)