1 Star 4 Fork 12

王布衣/pandas

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
type_bool.go 1.15 KB
一键复制 编辑 原始数据 按行查看 历史
王布衣 提交于 2023-02-08 05:30 . !37#I6DLC4实现BARSLAST函数
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
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/quant1x/pandas.git
git@gitee.com:quant1x/pandas.git
quant1x
pandas
pandas
v0.6.4

搜索帮助