3 Star 0 Fork 1

Gitee 极速下载 / gcfg

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/go-gcfg/gcfg
克隆/下载
bool.go 574 Bytes
一键复制 编辑 原始数据 按行查看 历史
package types
// BoolValues defines the name and value mappings for ParseBool.
var BoolValues = map[string]interface{}{
"true": true, "yes": true, "on": true, "1": true,
"false": false, "no": false, "off": false, "0": false,
}
var boolParser = func() *EnumParser {
ep := &EnumParser{}
ep.AddVals(BoolValues)
return ep
}()
// ParseBool parses bool values according to the definitions in BoolValues.
// Parsing is case-insensitive.
func ParseBool(s string) (bool, error) {
v, err := boolParser.Parse(s)
if err != nil {
return false, err
}
return v.(bool), nil
}
1
https://gitee.com/mirrors/gcfg.git
git@gitee.com:mirrors/gcfg.git
mirrors
gcfg
gcfg
v1.2.3

搜索帮助