Created
December 21, 2015 01:33
-
-
Save ilyabrin/fe46ec11b32eb37a1d71 to your computer and use it in GitHub Desktop.
Golang Reverse String
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 main | |
| import "fmt" | |
| func main() { | |
| fmt.Println(reverse("Golang!")) | |
| } | |
| func reverse(s string) (ret string) { | |
| for _, v := range s { | |
| defer func(r rune) { ret += string(r) }(v) | |
| } | |
| return | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment