diff options
author | xuri <xuri.me@gmail.com> | 2022-02-18 00:02:39 +0800 |
---|---|---|
committer | xuri <xuri.me@gmail.com> | 2022-02-18 00:02:39 +0800 |
commit | 07be99363156b2d1011954be7b5a4cc8f33b256b (patch) | |
tree | 1b8230aea114fac9fb6f75b00d4ab459305abe94 /lib.go | |
parent | f87c39c41ddcb2fbb75a6035ba1dd28e4de8c71b (diff) |
Fixed parsing decimal precision issue
Diffstat (limited to 'lib.go')
-rw-r--r-- | lib.go | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -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 } |