mirror of https://github.com/01-edu/public.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
454 B
39 lines
454 B
2 years ago
|
## ascii
|
||
|
|
||
|
### Instructions
|
||
|
|
||
|
Write a function that receives a string and returns a slice with the ASCII values of its characters.
|
||
|
|
||
|
### Expected function
|
||
|
|
||
|
```go
|
||
|
func Ascii(str string) []byte {
|
||
|
|
||
|
}
|
||
|
```
|
||
|
|
||
|
### Usage
|
||
|
|
||
|
Here is a possible program to test your function:
|
||
|
|
||
|
```go
|
||
|
package main
|
||
|
|
||
|
import (
|
||
|
"piscine"
|
||
|
"fmt"
|
||
|
)
|
||
|
|
||
|
func main() {
|
||
|
l := piscine.Ascii("Hello")
|
||
|
fmt.Println(l)
|
||
|
}
|
||
|
```
|
||
|
|
||
|
And its output:
|
||
|
|
||
|
```console
|
||
|
$ go run .
|
||
|
[104 101 108 108 111]
|
||
|
```
|