How do you write multiline strings in Go?

前端 未结 9 945
傲寒
傲寒 2020-12-07 07:25

Does Go have anything similar to Python\'s multiline strings:

\"\"\"line 1
line 2
line 3\"\"\"

9条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-07 07:44

    According to the language specification you can use a raw string literal, where the string is delimited by backticks instead of double quotes.

    `line 1
    line 2
    line 3`
    

提交回复
热议问题