From 8468df1f058d33fa07df38ab57ffa3a23d007633 Mon Sep 17 00:00:00 2001 From: Hamza elkhatri <40549481+Hamzaelkhatri@users.noreply.github.com> Date: Tue, 20 Jun 2023 14:11:52 +0300 Subject: [PATCH] DEV-3206-new-go-exercice-string-to-bool (#1353) * DEV-3206 add(docs):StringTobool readme * DEV-3206 fix(docs):replace the example * Update README.md * docs(stringtobool): fix subject - upgraded instructions - fix 'expected function' - add missing import 'piscine' - fix white-spaces and indentation * docs(stringtobool): fix typo --------- Co-authored-by: Tiago Collot Co-authored-by: Michele Sessa --- subjects/stringtobool/README.md | 46 +++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 subjects/stringtobool/README.md diff --git a/subjects/stringtobool/README.md b/subjects/stringtobool/README.md new file mode 100644 index 000000000..3c4dd0952 --- /dev/null +++ b/subjects/stringtobool/README.md @@ -0,0 +1,46 @@ +## stringtobool + +### Instructions + +Write a function that takes a `string` as an argument and returns a `boolean`. + +- If the `string` equals `True`, `T` or `t` return `true`, otherwise return `false`. + + +### Expected function + +```go +func StringToBool(s string) bool { + +} +``` + +### Usage + +Here is a possible program to test your function: + +```go +package main + +import ( + "fmt" + "piscine" +) + +func main() { + fmt.Println(piscine.StringToBool("True")) + fmt.Println(piscine.StringToBool("T")) + fmt.Println(piscine.StringToBool("False")) + fmt.Println(piscine.StringToBool("TTFF")) +} +``` + +And its output: + +```console +$ go run . +true +true +false +false +```