From 70f2e7ead2d7a1269e7806c42151dac3e3793a29 Mon Sep 17 00:00:00 2001 From: "marko.tikvic" Date: Thu, 27 Jun 2019 10:51:54 +0200 Subject: [PATCH] simplified --- string_util.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/string_util.go b/string_util.go index 03ac492..e91f655 100644 --- a/string_util.go +++ b/string_util.go @@ -2,6 +2,7 @@ package webutility import ( "fmt" + "strconv" "strings" ) @@ -70,11 +71,8 @@ func ReplaceAny(s, patern, r string) (n string) { } func StringToBool(s string) bool { - s = strings.ToLower(s) - if s == "true" { - return true - } - return false + res, _ := strconv.ParseBool(s) + return res } func BoolToString(b bool) string { -- 1.8.1.2