C
C#5mo ago
Caeden

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
Caeden
Caeden5mo ago
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-strings
Standard numeric format strings - .NET
In this article, learn to use standard numeric format strings to format common numeric types into text representations in .NET.
canton7
canton75mo ago
What are you trying to do? Those are two separate things
Caeden
Caeden5mo ago
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 here
canton7
canton75mo ago
Custom 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.
Angius
Angius5mo ago
00.00 would be the format, wouldn't it?
MODiX
MODiX5mo ago
Angius
REPL Result: Success
var x = 3.7; $"{x:00.00}"
var x = 3.7; $"{x:00.00}"
Result: string
03.70
03.70
Compile: 369.286ms | Execution: 29.070ms | React with ❌ to remove this embed.
Angius
Angius5mo ago
ye
Caeden
Caeden5mo ago
Thanks Thanks as well
Want results from more Discord servers?
Add your server
More Posts
.NET MAUI Android Error: Type androidx.collection.ArrayMapKit is defined multiple timesthis error happens to me when i download firebase storage or firebase firestore plugins. New projectI'm getting "specified method is not supported" when I include a specific navigation property with eI'm using ASP.NET Core Identity with a custom IdentityUser that looks like this: public class AppliIs there a way to authenticate using OAuth2 token and map it to internal JWTBasically, my server checks for some stuff by utilizing OAuth2 token and returns JWT Im looking for Beginner question. what does this createhostbuilder do?I'm learning .net core and I saw this code in program.cs. I can understand the main method calls thiim creating a game in unity for school, and need some help with a script errorso the purpose of the script is to freeze the character in place and block all inputs when "p" is prFile writingAnyone know a way around or how to fix this? none of my previous practice apps have come up with thican some xpalin why in LinqIn linquo querys i need to. use the word Select(p => new) what dose new mean i dont want to create aIndex in C#Can someone just explain to me how i solve this problem. i have made a code with two machines and imi need help with one exercise using cyclesJack wanted to plant hyacinths. Hyacinth bulbs of N different colours were available on the market, Need help with generic vector mathI'm trying to create a Vector type with generic math approach. ```cs //my vector class public reado