23 lines
588 B
C#
23 lines
588 B
C#
using System.Globalization;
|
|
|
|
namespace trakker.Utilities
|
|
{
|
|
public static class CurrencyExtensions
|
|
{
|
|
const int labelWidth = 35;
|
|
const int valueWidth = 20;
|
|
|
|
public static string PrintLine(string label, double amount)
|
|
{
|
|
string formatted = amount.ToString("C2", CultureInfo.GetCultureInfo("en-US"));
|
|
return String.Format($"{label,-labelWidth}{formatted,valueWidth}");
|
|
}
|
|
|
|
public static string PrintSeparator(int width = 60, char ch = '-')
|
|
{
|
|
return new string(ch, width);
|
|
}
|
|
|
|
}
|
|
}
|