From 07be99363156b2d1011954be7b5a4cc8f33b256b Mon Sep 17 00:00:00 2001 From: xuri Date: Fri, 18 Feb 2022 00:02:39 +0800 Subject: Fixed parsing decimal precision issue --- lib.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'lib.go') 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 } -- cgit v1.2.1