- Str2Float64WithDefault

This commit is contained in:
gazebo
2018-09-28 12:11:25 +08:00
parent e9fa710d42
commit 933c218e00

View File

@@ -171,6 +171,14 @@ func Str2Int64(str string) int64 {
return retVal
}
func Str2Float64WithDefault(str string, defValue float64) float64 {
retVal, err := strconv.ParseFloat(str, 64)
if err != nil {
retVal = defValue
}
return retVal
}
func Str2Float64(str string) float64 {
retVal, err := strconv.ParseFloat(str, 64)
if err != nil {