Heim  >  Artikel  >  Backend-Entwicklung  >  So drucken Sie einfache und doppelte Anführungszeichen in Golang

So drucken Sie einfache und doppelte Anführungszeichen in Golang

angryTom
angryTomOriginal
2020-03-14 15:37:413765Durchsuche

So drucken Sie einfache und doppelte Anführungszeichen in Golang

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

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

相关推荐:golang教程

package main

import "fmt"

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

输出结果:

'
"

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 之间的文本,忽略文本中的正则语法

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

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

Das obige ist der detaillierte Inhalt vonSo drucken Sie einfache und doppelte Anführungszeichen in Golang. Für weitere Informationen folgen Sie bitte anderen verwandten Artikeln auf der PHP chinesischen Website!

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn