File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ using System . Globalization ;
2+
13namespace Orbit . Domain . Extensions
24{
35 public static class CurrencyExtensions
46 {
7+ private static readonly CultureInfo GbCulture = new ( "en-GB" ) ;
8+
59 /// <summary>
610 /// Converts pence (long) to pounds and formats as GBP currency string (e.g., "£123.45")
711 /// </summary>
@@ -10,8 +14,7 @@ public static class CurrencyExtensions
1014 public static string ToPoundsString ( this long pence )
1115 {
1216 var pounds = pence / 100m ;
13- var sign = pence < 0 ? "-" : "" ;
14- return $ "{ sign } £{ Math . Abs ( pounds ) : N2} ";
17+ return pounds . ToString ( "C" , GbCulture ) ;
1518 }
1619
1720 /// <summary>
@@ -22,8 +25,7 @@ public static string ToPoundsString(this long pence)
2225 public static string ToPoundsString ( this decimal pence )
2326 {
2427 var pounds = pence / 100m ;
25- var sign = pence < 0 ? "-" : "" ;
26- return $ "{ sign } £{ Math . Abs ( pounds ) : N2} ";
28+ return pounds . ToString ( "C" , GbCulture ) ;
2729 }
2830 }
2931}
You can’t perform that action at this time.
0 commit comments