Adds a ToFormat
instance method to Big
or BigDecimal
.
You can install ToFormatSharp for Big or BigDecimal via NuGet:
package manager:
$ PM> Install-Package BigSharp.ToFormat
$ PM> Install-Package DecimalSharp.ToFormat
NET CLI:
$ dotnet add package BigSharp.ToFormat
$ dotnet add package DecimalSharp.ToFormat
using BigSharp;
using BigSharp.ToFormat;
var format = new FormatOptions
{
DecimalSeparator = ".",
GroupSeparator = ",",
GroupSize = 3,
SecondaryGroupSize = 0,
FractionGroupSeparator = "",
FractionGroupSize = 0
};
x = new Big(9876.54321)
x.ToFormat(2, format) // "9,876.54"
format.DecimalSeparator = ","
format.GroupSeparator = " "
format.groupSize = 2
x.ToFormat(1, format) // "98 76,5"
ToFormatSharp supports:
- Net 6
Make sure to rebuild projects every time you change code for testing.
To run tests:
$ dotnet test