2019-06-06 21:32:12 -05:00
|
|
|
package shell
|
|
|
|
|
2024-01-25 00:39:14 -06:00
|
|
|
/*
|
2019-06-06 21:32:12 -05:00
|
|
|
send it anything, always get back an int
|
|
|
|
*/
|
|
|
|
|
|
|
|
// import "log"
|
|
|
|
// import "reflect"
|
|
|
|
// import "strings"
|
|
|
|
// import "bytes"
|
|
|
|
import "strconv"
|
|
|
|
|
|
|
|
func Int(s string) int {
|
|
|
|
s = Chomp(s)
|
|
|
|
i, err := strconv.Atoi(s)
|
2024-01-25 00:39:14 -06:00
|
|
|
if err != nil {
|
2019-06-06 21:32:12 -05:00
|
|
|
handleError(err, -1)
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
return i
|
|
|
|
}
|
2019-06-06 22:55:21 -05:00
|
|
|
|
|
|
|
func Int64(s string) int64 {
|
|
|
|
s = Chomp(s)
|
|
|
|
i, err := strconv.Atoi(s)
|
2024-01-25 00:39:14 -06:00
|
|
|
if err != nil {
|
2019-06-06 22:55:21 -05:00
|
|
|
handleError(err, -1)
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
return int64(i)
|
|
|
|
}
|