fix 0 credit being shown with M suffix

This commit is contained in:
Florian Stinglmayr 2021-08-28 00:56:32 +02:00
parent 17bf02bef8
commit c974a9f3ac

View File

@ -7,10 +7,10 @@ namespace EDJournal {
format.NumberGroupSeparator = ","; format.NumberGroupSeparator = ",";
format.NumberGroupSizes = new int[1] { 3 }; format.NumberGroupSizes = new int[1] { 3 };
format.NumberDecimalDigits = 0; format.NumberDecimalDigits = 0;
if ((amount % 1000000) == 0) { if (amount > 0 && (amount % 1000000) == 0) {
amount /= 1000000; amount /= 1000000;
return string.Format("{0}M CR", amount.ToString("N", format)); return string.Format("{0}M CR", amount.ToString("N", format));
} else if ((amount % 1000) == 0) { } else if (amount > 0 && (amount % 1000) == 0) {
amount /= 1000; amount /= 1000;
return string.Format("{0}K CR", amount.ToString("N", format)); return string.Format("{0}K CR", amount.ToString("N", format));
} }