- Str2Float64WithDefault
This commit is contained in:
@@ -171,6 +171,14 @@ func Str2Int64(str string) int64 {
|
|||||||
return retVal
|
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 {
|
func Str2Float64(str string) float64 {
|
||||||
retVal, err := strconv.ParseFloat(str, 64)
|
retVal, err := strconv.ParseFloat(str, 64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user