negative number parsing

This commit is contained in:
Aidan 2020-08-21 00:14:31 -07:00
parent 69536783c7
commit 90284f2d06
No known key found for this signature in database
GPG key ID: 327711E983899316
3 changed files with 86 additions and 0 deletions

View file

@ -215,6 +215,11 @@ error:
func StrIsNumber(arg string) bool {
dotCount := 0
// negative nums
if len(arg) > 0 && arg[0] == '-' {
arg = arg[1:]
}
for _, char := range arg {
if !unicode.IsDigit(char) {
if char == '.' && dotCount == 0 {