Test Setup Failed
Pull Request — main (#60)
by Igor
02:01
created

is/numeric.go   A

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 8
dl 0
loc 14
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A is.Number 0 3 1
A is.Integer 0 3 1
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