From f94b4084c9f3353061fd0268aabe5d8b61a02e38 Mon Sep 17 00:00:00 2001 From: Florian Stinglmayr Date: Fri, 27 Aug 2021 22:37:06 +0200 Subject: [PATCH] fix formatting of credits --- Credits.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Credits.cs b/Credits.cs index 292ef6a..fa69b8f 100644 --- a/Credits.cs +++ b/Credits.cs @@ -3,18 +3,19 @@ namespace EDJournal { public class Credits { public static string FormatCredits(int amount) { - var format = CultureInfo.CurrentCulture.NumberFormat; + var format = new CultureInfo(CultureInfo.CurrentCulture.Name, true).NumberFormat; format.NumberGroupSeparator = ","; format.NumberGroupSizes = new int[1] { 3 }; + format.NumberDecimalDigits = 0; if ((amount % 1000000) == 0) { amount /= 1000000; - return string.Format("{0}M CR", amount.ToString(format)); + return string.Format("{0}M CR", amount.ToString("N", format)); } else if ((amount % 1000) == 0) { amount /= 1000; - return string.Format("{0}K CR", amount.ToString(format)); + return string.Format("{0}K CR", amount.ToString("N", format)); } - return string.Format("{0} CR", amount.ToString(format)); + return string.Format("{0} CR", amount.ToString("N", format)); } } }