adventofcode/2018/internal/util/strings.go

15 lines
196 B
Go
Raw Normal View History

package util
func ReverseString(s string) string {
runes := []rune(s)
i := 0
j := len(runes) - 1
for i < j {
runes[i], runes[j] = runes[j], runes[i]
i++
j--
}
return string(runes)
}