Home > Backend Development > Golang > How to print single quotes and double quotes in Golang

How to print single quotes and double quotes in Golang

angryTom
Release: 2020-03-14 15:37:41
Original
3921 people have browsed it

How to print single quotes and double quotes in Golang

Golang如何打印单引号和双引号

Golang打印单引号可以直接使用fmt.Println("'"),Golang打印双引号需要使用转义字符fmt.Println("\"")。

相关推荐:golang教程

package main

import "fmt"

func main() {
   fmt.Println("'")
   fmt.Println("\"")
}
Copy after login

输出结果:

'
"
Copy after login

Golang转义字符如下:

\a             匹配响铃符    (相当于 \x07)
               注意:正则表达式中不能使用 \b 匹配退格符,因为 \b 被用来匹配单词边界,
               可以使用 \x08 表示退格符。
\f             匹配换页符    (相当于 \x0C)
\t             匹配横向制表符(相当于 \x09)
\n             匹配换行符    (相当于 \x0A)
\r             匹配回车符    (相当于 \x0D)
\v             匹配纵向制表符(相当于 \x0B)
\123           匹配 8  進制编码所代表的字符(必须是 3 位数字)
\x7F           匹配 16 進制编码所代表的字符(必须是 3 位数字)
\x{10FFFF}     匹配 16 進制编码所代表的字符(最大值 10FFFF  )
\Q...\E        匹配 \Q 和 \E 之间的文本,忽略文本中的正则语法

\\             匹配字符 \
\^             匹配字符 ^
\$             匹配字符 $
\.             匹配字符 .
\*             匹配字符 *
\+             匹配字符 +
\?             匹配字符 ?
\{             匹配字符 {
\}             匹配字符 }
\(             匹配字符 (
\)             匹配字符 )
\[             匹配字符 [
\]             匹配字符 ]
\|             匹配字符 |
Copy after login

PHP中文网,大量编程教程和MySQL视频教程,欢迎学习!

The above is the detailed content of How to print single quotes and double quotes in Golang. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
How to choose golang web mvc framework
From 1970-01-01 08:00:00
0
0
0
Is it necessary to use nginx when using golang?
From 1970-01-01 08:00:00
0
0
0
golang - vim plug-in to write go
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template