注意:
- go语言的字符串的字节使用utf-8编码标识Unicode文本,go语言统一使用utf-8编码
- 字符串一旦赋值,字符串不能被修改
字符串表现形式:
1.双引号,会识别转义字符
2.反引号,以字符原生形式输出,包括换行符和其他特殊字符
// 双引号
ss1 := "hello world!"
// 反引号
ss2 := `hello world!`
// 报错
ss3 := "hahha"
ss3[0] = 'd' // 报错,不能修改
注意:
1.双引号,会识别转义字符
2.反引号,以字符原生形式输出,包括换行符和其他特殊字符
// 双引号
ss1 := "hello world!"
// 反引号
ss2 := `hello world!`
// 报错
ss3 := "hahha"
ss3[0] = 'd' // 报错,不能修改