Repeat 'len(s)'.

This commit is contained in:
bert 2022-03-09 10:53:28 +08:00
parent 8f326dcac5
commit 4f95d0a07a

View File

@ -57,13 +57,13 @@ func IsNumeric(s string) bool {
if length == 0 { if length == 0 {
return false return false
} }
for i := 0; i < len(s); i++ { for i := 0; i < length; i++ {
if s[i] == '-' && i == 0 { if s[i] == '-' && i == 0 {
continue continue
} }
if s[i] == '.' { if s[i] == '.' {
dotCount++ dotCount++
if i > 0 && i < len(s)-1 { if i > 0 && i < length-1 {
continue continue
} else { } else {
return false return false