Golang strconv.ParseBool() function example
package strconv
Golang strconv.ParseBool() function usage example.
package main
import (
"fmt"
"strconv"
)
func main() {
str := "1"
value, err := strconv.ParseBool(str)
if err != nil {
fmt.Println(err)
}
fmt.Println(value)
}
ParseBool returns the boolean value represented by the string. It accepts 1, t, T, TRUE, true, True, 0, f, F, FALSE, false, False. Any other value returns an error.
Reference :
Advertisement
Something interesting
Tutorials
+8.6k Python : Fix SyntaxError: Non-ASCII character in file, but no encoding declared
+46.2k Golang : Read tab delimited file with encoding/csv package
+11.6k Swift : Convert (cast) Float to String
+15.3k Golang : Delete certain files in a directory
+26.9k Golang : Force your program to run with root permissions
+8.8k Golang : Take screen shot of browser with JQuery example
+5.5k Golang : Stop goroutine without channel
+36.3k Golang : Convert(cast) int64 to string
+5.2k Golang : Print instead of building pyramids
+11.1k Golang : Roll the dice example
+11.2k Golang : Proper way to test CIDR membership of an IP 4 or 6 address example