在 Go1 中,符文是一种内置类型。 func Reverse(s string) string { runes := []rune(s) for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 { runes[i], runes[j] = runes[j], runes[i] } return string(runes) } 原文由 yazu 发布,翻译遵循 CC BY-SA 3.0 许可协议
在 Go1 中,符文是一种内置类型。