Skip to content

Conversation

@sisve
Copy link
Contributor

@sisve sisve commented Apr 7, 2025

This fixes #3134 where numeric formatting pattern does not work.

The old behavior sends ScalarValue objects to String.Format, which .NET knows nothing about. By unwrapping ScalarValue's into their primitive values we get support for formatting patterns related to Int32 and Double, the only two subclasses of ScalarValue.

Related:

Before:

    print "{0:0.0}":format(13.37).
    > prints "13.37"

After:

    print "{0:0.0}":format(13.37).
    > prints "13.4"

@sisve sisve changed the title Fix numeric formatting patterns by unwrapping scalar values (fixes #3134) Fix numeric formatting patterns by unwrapping scalar values Apr 7, 2025
@JonnyOThan JonnyOThan merged commit 5780b75 into KSP-KOS:develop Apr 7, 2025
1 check passed
@sisve sisve deleted the fix-string-format branch April 7, 2025 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Numeric formatting patterns does not work

2 participants