summaryrefslogtreecommitdiff
path: root/int.go
blob: bf78209baccbd0561e2b5ab36f865421c186dc12 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package shell

/*
	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)
	if err != nil {
		handleError(err, -1)
		return 0
	}
	return i
}

func Int64(s string) int64 {
	s = Chomp(s)
	i, err := strconv.Atoi(s)
	if err != nil {
		handleError(err, -1)
		return 0
	}
	return int64(i)
}