summaryrefslogtreecommitdiff
path: root/lib.go
diff options
context:
space:
mode:
authorxuri <xuri.me@gmail.com>2022-02-18 00:02:39 +0800
committerxuri <xuri.me@gmail.com>2022-02-18 00:02:39 +0800
commit07be99363156b2d1011954be7b5a4cc8f33b256b (patch)
tree1b8230aea114fac9fb6f75b00d4ab459305abe94 /lib.go
parentf87c39c41ddcb2fbb75a6035ba1dd28e4de8c71b (diff)
Fixed parsing decimal precision issue
Diffstat (limited to 'lib.go')
-rw-r--r--lib.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib.go b/lib.go
index 47ce2fe..d0ae62c 100644
--- a/lib.go
+++ b/lib.go
@@ -675,22 +675,27 @@ func (f *File) addSheetNameSpace(sheet string, ns xml.Attr) {
// isNumeric determines whether an expression is a valid numeric type and get
// the precision for the numeric.
func isNumeric(s string) (bool, int) {
- dot, n, p := false, false, 0
+ dot, e, n, p := false, false, false, 0
for i, v := range s {
if v == '.' {
if dot {
return false, 0
}
dot = true
+ } else if v == 'E' || v == 'e' {
+ e = true
} else if v < '0' || v > '9' {
if i == 0 && v == '-' {
continue
}
+ if e && v == '-' {
+ continue
+ }
return false, 0
} else if dot {
- n = true
p++
}
+ n = true
}
return n, p
}