package main import "fmt" func main() { str := "XBodyContentX" content := str[1 : len(str)-1] fmt.Println(content) } 运行结果为:BodyContent
package main import "fmt" func main() { str := "XBodyContentX" content := str[1 : len(str)-1] fmt.Println(content) } 运行结果为:BodyContent