Created
July 31, 2013 14:23
-
-
Save fsouza/6122425 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package str | |
| func Reverse(input string) string { | |
| runes := []rune(input) | |
| half := len(runes) / 2 | |
| for i := 0; i < half; i++ { | |
| runes[i], runes[i + half] = runes[i + half], runes[i] | |
| } | |
| return string(runes) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment