Tried to format USD as "$500" and SEK as "500kr", but I realized not even Airbnb could do it properly, so I might do this later... Let me know if you've struggled with this, I have questions! πŸ™πŸ‘Œ

Tomas Woksepp Author

That is a bit of work for sure… I'll postpone it a bit and then find a way to convert USD to en-US etc. later on! Thanks again for the help πŸ‘Œ

0 Likes
Jimmy Nilsson

I would probably rely on something prebuilt, aint got time to reinvent the wheel ;) That said, my guess is you will actually need the locale in en-US/en_US format to use the built in methods

0 Likes
Tomas Woksepp Author

Interesting! I use PHP, I heard there is a function very similar to it. Would you say it's more convenient doing it manually, or rely on things like CultureInfo? ☺️ I only store 3-letter currency names, like USD, SEK, GBP etc. Thanks πŸ™

0 Likes
Jimmy Nilsson

decimal dec = 123.00M; string uk = dec.ToString("C", new CultureInfo("en-GB"));

0 Likes
Jimmy Nilsson

Not sure what your stack looks like, but it is super easy in C#

0 Likes

Please sign in to leave a comment.