forked from root/public
estlop
2 years ago
committed by
eslopfer
1 changed files with 38 additions and 0 deletions
@ -0,0 +1,38 @@ |
|||||||
|
## 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] |
||||||
|
``` |
Loading…
Reference in new issue