From 8152bbb2cec76f074dc18c43f3c66bf8abdf9de0 Mon Sep 17 00:00:00 2001 From: xuri Date: Fri, 12 Aug 2022 00:32:51 +0800 Subject: This closes #1312, #1313, fix number format issue - Add supported options in the docs of the functions `SetSheetPrOptions` and `GetSheetPrOptions` - Add go1.19 unit test settings, and made the test case compatible with go1.19 - Update dependencies module --- numfmt.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'numfmt.go') diff --git a/numfmt.go b/numfmt.go index 6b4fc65..56f354f 100644 --- a/numfmt.go +++ b/numfmt.go @@ -337,7 +337,7 @@ func (nf *numberFormat) positiveHandler() (result string) { nf.result += token.TValue continue } - if token.TType == nfp.TokenTypeZeroPlaceHolder && token.TValue == "0" { + if token.TType == nfp.TokenTypeZeroPlaceHolder && token.TValue == strings.Repeat("0", len(token.TValue)) { if isNum, precision := isNumeric(nf.value); isNum { if nf.number < 1 { nf.result += "0" @@ -899,7 +899,7 @@ func (nf *numberFormat) negativeHandler() (result string) { nf.result += token.TValue continue } - if token.TType == nfp.TokenTypeZeroPlaceHolder && token.TValue == "0" { + if token.TType == nfp.TokenTypeZeroPlaceHolder && token.TValue == strings.Repeat("0", len(token.TValue)) { if isNum, precision := isNumeric(nf.value); isNum { if math.Abs(nf.number) < 1 { nf.result += "0" -- cgit v1.2.1