summaryrefslogtreecommitdiff
path: root/int.go
blob: dcf6b1e2880ac416c22adc05190a458dfabd005d (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)
}