public/subjects/strrev/README.md

43 lines
452 B
Markdown
Raw Permalink Normal View History

2019-04-24 17:17:07 +00:00
## strrev
2019-04-24 17:06:54 +00:00
2019-04-24 17:17:07 +00:00
### Instructions
2019-04-24 17:06:54 +00:00
2020-02-25 12:02:16 +00:00
- Write a function that reverses a `string`.
2019-04-24 17:06:54 +00:00
2021-06-02 16:33:44 +00:00
- This function will **return** the reversed `string`.
2019-04-24 17:06:54 +00:00
2019-04-24 17:17:07 +00:00
### Expected function
2019-04-24 17:06:54 +00:00
```go
func StrRev(s string) string {
}
```
2019-04-24 17:17:07 +00:00
### Usage
2019-04-24 17:06:54 +00:00
2020-02-25 12:02:16 +00:00
Here is a possible program to test your function :
2019-04-24 17:06:54 +00:00
```go
package main
import (
"fmt"
"piscine"
2019-04-24 17:06:54 +00:00
)
func main() {
s := "Hello World!"
s = piscine.StrRev(s)
fmt.Println(s)
}
```
And its output :
```console
$ go run .
2019-04-24 17:06:54 +00:00
!dlroW olleH
$
2019-04-24 17:06:54 +00:00
```