@@ -7,6 +7,11 @@ namespace Utils
7
7
{
8
8
public class CurrencyUtils
9
9
{
10
+ /// <summary>
11
+ /// Returns a label of the given currency
12
+ /// </summary>
13
+ /// <param name="currency">Currency whose label should be returned</param>
14
+ /// <returns>Label of the given currency</returns>
10
15
public static string GetCurrencyLabel ( Currency currency )
11
16
{
12
17
switch ( currency )
@@ -22,6 +27,12 @@ public static string GetCurrencyLabel(Currency currency)
22
27
return "UNDEFINED" ;
23
28
}
24
29
30
+ /// <summary>
31
+ /// Format's the given value and currency due to currency's formatting rules
32
+ /// </summary>
33
+ /// <param name="value">Value to be formatted</param>
34
+ /// <param name="currency">Currency to be used</param>
35
+ /// <returns>A string containing both the value and the currency symbol in the correct format</returns>
25
36
public static string Format ( decimal value , Currency currency )
26
37
{
27
38
var valueStr = DecimalUtils . FormatTwoDecimalPlaces ( Math . Abs ( value ) ) ;
@@ -50,6 +61,13 @@ public static string Format(decimal value, Currency currency)
50
61
return output ;
51
62
}
52
63
64
+ /// <summary>
65
+ /// Format's the given value and currency due to currency's formatting rules. Adds the plus symbol when the value
66
+ /// is positive.
67
+ /// </summary>
68
+ /// <param name="value">Value to be formatted</param>
69
+ /// <param name="currency">Currency to be used</param>
70
+ /// <returns>A string containing both the value and the currency symbol in the correct format</returns>
53
71
public static string FormatWithPlusSign ( decimal value , Currency currency ) =>
54
72
( value > 0 ? "+" : "" ) + Format ( value , currency ) ;
55
73
}
0 commit comments