Commit 70f2e7ead2d7a1269e7806c42151dac3e3793a29
1 parent
e9419e37db
Exists in
master
simplified
Showing
1 changed file
with
3 additions
and
5 deletions
Show diff stats
string_util.go
... | ... | @@ -2,6 +2,7 @@ package webutility |
2 | 2 | |
3 | 3 | import ( |
4 | 4 | "fmt" |
5 | + "strconv" | |
5 | 6 | "strings" |
6 | 7 | ) |
7 | 8 | |
... | ... | @@ -70,11 +71,8 @@ func ReplaceAny(s, patern, r string) (n string) { |
70 | 71 | } |
71 | 72 | |
72 | 73 | func StringToBool(s string) bool { |
73 | - s = strings.ToLower(s) | |
74 | - if s == "true" { | |
75 | - return true | |
76 | - } | |
77 | - return false | |
74 | + res, _ := strconv.ParseBool(s) | |
75 | + return res | |
78 | 76 | } |
79 | 77 | |
80 | 78 | func BoolToString(b bool) string { | ... | ... |