Passed
Push — main ( aa8c07...4607a7 )
by Igor
02:58 queued 01:09
created

is.Number   A

Complexity

Conditions 1

Size

Total Lines 3
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
package is
2
3
import "strconv"
4
5
// Integer checks that string is an integer.
6
func Integer(s string) bool {
7
	_, err := strconv.Atoi(s)
8
	return err == nil
9
}
10
11
// Number checks that string is a number (a float or an integer).
12
func Number(s string) bool {
13
	_, err := strconv.ParseFloat(s, 64)
14
	return err == nil
15
}
16