Skip to content

Commit

Permalink
Handle the format '?' in number formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
kurtinge committed Jan 30, 2025
1 parent 4324622 commit 4d7817c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion numfmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -5006,7 +5006,7 @@ func (nf *numberFormat) printNumberLiteral(text string) string {
if token.TType == nfp.TokenTypeLiteral {
result += token.TValue
}
if token.TType == nfp.TokenTypeHashPlaceHolder || token.TType == nfp.TokenTypeZeroPlaceHolder {
if token.TType == nfp.TokenTypeHashPlaceHolder || token.TType == nfp.TokenTypeZeroPlaceHolder || token.TType == nfp.TokenTypeDigitalPlaceHolder {
digits, str := handleDigitsLiteral(text, len(token.TValue), intPartLen, hashZeroPartLen)
intPartLen += digits
result += str
Expand Down
1 change: 1 addition & 0 deletions numfmt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3635,6 +3635,7 @@ func TestNumFmt(t *testing.T) {
{"123", "[$x.-unknown]MM/DD/YYYY", "x.05/02/1900"},
{"1234.5678", "0.0xxx00", "1234.5xxx68"},
{"80145.899999999994", "[$¥-8004]\" \"#\" \"####\"\"", "¥ 8 0146"},
{"1", "?", "1"},
// Unsupported number format
{"37947.7500001", "0.00000000E+000", "37947.7500001"},
{"123", "[DBNum4][$-804]yyyy\"\"m\"\";@", "123"},
Expand Down

0 comments on commit 4d7817c

Please sign in to comment.