From c6e150901edf8b773f7f3f69bd8960341db92e99 Mon Sep 17 00:00:00 2001 From: Tiago Collot Date: Mon, 19 Sep 2022 15:17:36 +0100 Subject: [PATCH] feat(piscine-go): add README.md for new go exercise stringtointarray --- subjects/stringtointarray/README.md | 38 +++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 subjects/stringtointarray/README.md diff --git a/subjects/stringtointarray/README.md b/subjects/stringtointarray/README.md new file mode 100644 index 00000000..2c2b6a13 --- /dev/null +++ b/subjects/stringtointarray/README.md @@ -0,0 +1,38 @@ +## stringtointarray + +### Instructions + +Write a function `StringToIntArray()` that takes a string and returns the corresponding integer array. + +### Expected function + +```go +func StringToIntArray(str string) []int { + +} +``` + +### Usage + +Here is a possible program to test your function: + +```go +package main + +import "fmt" + +func main() { + fmt.Println(StringToIntArray("A quick brown fox jumps over the lazy dog")) + fmt.Println(StringToIntArray("Converted this string into an int")) + fmt.Println(StringToIntArray("hello THERE")) +} +``` + +And its output: + +```go +$ go run . | cat -e +[65 32 113 117 105 99 107 32 98 114 111 119 110 32 102 111 120 32 106 117 109 112 115 32 111 118 101 114 32 116 104 101 32 108 97 122 121 32 100 111 103]$ +[67 111 110 118 101 114 116 101 100 32 116 104 105 115 32 115 116 114 105 110 103 32 105 110 116 111 32 97 110 32 105 110 116]$ +[104 101 108 108 111 32 84 72 69 82 69]$ +```