Combine string formatting (eg `$"{number:N2}" with D2) so like `{number:N2D2}`)
You have string interpolation like $"{number:N2}", how can I combine formats?
Like $"{number:N2D2}"
8 Replies
this doesn't work, nor does
number:N2:D2
, and I couldn't find it here https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-numeric-format-stringsStandard numeric format strings - .NET
In this article, learn to use standard numeric format strings to format common numeric types into text representations in .NET.
What are you trying to do? Those are two separate things
I want to pad a float left and right
So
3.7
becomes 03.70
D2
does like pad left and N
does pad right as far as I am aware from what it says hereCustom numeric format strings - .NET
Learn how to create a custom numeric format string to format numeric data in .NET. A custom numeric format string has one or more custom numeric specifiers.
00.00
would be the format, wouldn't it?Angius
REPL Result: Success
Result: string
Compile: 369.286ms | Execution: 29.070ms | React with ❌ to remove this embed.
ye
Thanks
Thanks as well