mirror of
https://gitee.com/johng/gf.git
synced 2024-12-02 04:07:47 +08:00
Repeat 'len(s)'.
This commit is contained in:
parent
8f326dcac5
commit
4f95d0a07a
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user