fix(number_format): re-attach literal affixes around formatted numbers#346
Merged
MathNya merged 2 commits intoJul 22, 2026
Merged
Conversation
Quoted literals after the digit placeholders were dropped, so '#,##0.00" €"' printed only the bare number. Attach the literal prefix/suffix surrounding the placeholder run (with skip-width '_x' placeholders rendered as spaces), replacing the dollar-only prefix special case for numeric formats. Signed-off-by: Yonghye Kwon <developer.0hye@gmail.com>
developer0hye
force-pushed
the
fix/number-format-literal-affixes-upstream
branch
from
July 21, 2026 17:01
6105ead to
b2f7808
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
get_formatted_value()drops literal text around the digit placeholders in numeric formats:#,##0.00" €"returns1,240.00— Excel shows1,240.00 €.$disappear:€ 0.00returns39.15— Excel shows€ 39.15(only a\$[^0-9]*match was ever prepended).(#,##0)returns1,234— Excel shows(1,234).Fix
After the numeric core is formatted, re-attach the literal text found before the first and after the last digit placeholder of the (bracket-stripped) format. Quotes and escapes are already stripped at that point;
_xskip-width placeholders render as a plain space, which is how they display in practice. The dollar-only prefix special case now applies only on paths that don't attach affixes (fractions), preserving its previous behavior there.Note: test values deliberately avoid decimal-rounding ties, which are addressed separately in #345.
Testing
cargo test— full suite green🤖 Generated with Claude Code