public/subjects/ascii
estlop 3097cd47f3 docs: Add what to do when string is empty as per review 2022-06-28 11:10:45 +01:00
..
README.md docs: Add what to do when string is empty as per review 2022-06-28 11:10:45 +01:00

README.md

ascii

Instructions

Write a function that receives a string and returns a slice with the ASCII values of its characters. If the string is empty it should return an empty slice.

Expected function

func Ascii(str string) []byte {

}

Usage

Here is a possible program to test your function:

package main

import (
    "piscine"
    "fmt"
)

func main() {
    l := piscine.Ascii("Hello")
    fmt.Println(l)
}

And its output:

$ go run .
[104 101 108 108 111]