You've already forked reloading-manager
No changes made
This commit is contained in:
21
backend/handlers/numbers.go
Normal file
21
backend/handlers/numbers.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package handlers
|
||||
|
||||
import "strconv"
|
||||
|
||||
func ParseFloat32(v string) (float32, error) {
|
||||
fl, err := strconv.ParseFloat(v, 32)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
return float32(fl), nil
|
||||
}
|
||||
|
||||
func ParseInt32WithDefault(s string, def int32) int32 {
|
||||
sInt, err := strconv.ParseInt(s, 10, 32)
|
||||
if err != nil {
|
||||
return def
|
||||
}
|
||||
|
||||
return int32(sInt)
|
||||
}
|
||||
Reference in New Issue
Block a user