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.
 
 
 
 
 
 

598 B

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

func StringToBool(s string) bool {

}

Usage

Here is a possible program to test your function:

package main

import (
	"fmt"
)

func main() {
	fmt.Println(StringToBool("True"))
	fmt.Println(StringToBool("T"))
	fmt.Println(StringToBool("False"))
	fmt.Println(StringToBool("TTFF"))
}

And its output:

$ go run .
true
true
false
false