代码拉取完成,页面将自动刷新
package stat
const (
Nil2Bool = false // 空指针转bool
BoolNaN = false // bool 无效值
True2Bool = true // true转bool
False2Bool = false // false 转bool
True2Float32 float32 = float32(1) // true转float32
False2Float32 float32 = float32(0) // false转float32
StringBad2Bool = false // 字符串解析bool异常
StringTrue2Bool = true // 字符串true转bool
StringFalse2Bool = false // 字符串false转bool
)
func isTrue(s string) bool {
if s == "true" || s == "TRUE" || s == "True" || s == "1" || s == "真" || s == "对" || s == "好" {
return true
} else {
return false
}
}
func isFalse(s string) bool {
if s == "false" || s == "FALSE" || s == "False" || s == "0" || s == "假" || s == "错" || s == "坏" {
return true
} else {
return false
}
}
func boolToInt64(b bool) int64 {
if b {
return True2Int64
}
return False2Int64
}
// bool转float32
func boolToFloat32(b bool) float32 {
if b {
return True2Float32
}
return False2Float32
}
// bool转float64
func boolToFloat64(b bool) float64 {
if b {
return True2Float64
}
return False2Float64
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。