Golang has the slices.Reverse()
for byte slices so you have a simple ASCII string then you can convert the string to byte slice, reverse and convert back to string:
str := "abc"strBytes := []byte(str)slices.Reverse(strBytes)reversed := string(strBytes)println(reversed) // prints cba
But please note that you'll have two memory allocations: str->bytes and bytes->str so this shouldn't be used in a performance critical code.But sometimes you may use the byte slice directly so the second allocation won't happen.