-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit e4b48f7
Showing
18 changed files
with
2,001 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
**/obj | ||
**/bin | ||
.vs/ | ||
packages/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
<GeneratePackageOnBuild>True</GeneratePackageOnBuild> | ||
<Version>1.0.0</Version> | ||
<Authors>XeroXP</Authors> | ||
<Description>Adds a ToFormat instance method to Big.</Description> | ||
<Copyright>Copyright (c) $(Authors) 2022</Copyright> | ||
<PackageProjectUrl>https://github.com/XeroXP/ToFormatSharp</PackageProjectUrl> | ||
<PackageReadmeFile>README.md</PackageReadmeFile> | ||
<RepositoryUrl>https://github.com/XeroXP/ToFormatSharp.git</RepositoryUrl> | ||
<RepositoryType>git</RepositoryType> | ||
<PackageTags>format, formatting</PackageTags> | ||
<PackageLicenseFile>LICENSE</PackageLicenseFile> | ||
<PackageRequireLicenseAcceptance>False</PackageRequireLicenseAcceptance> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<None Include="..\README.md"> | ||
<Pack>True</Pack> | ||
<PackagePath>\</PackagePath> | ||
</None> | ||
<None Include="..\LICENSE"> | ||
<Pack>True</Pack> | ||
<PackagePath>\</PackagePath> | ||
</None> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="BigSharp" Version="2.0.1" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\ToFormatSharp.Core\ToFormatSharp.Core.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using ToFormatSharp.Core; | ||
using ToFormatSharp.Core.Extensions; | ||
|
||
namespace BigSharp.ToFormat | ||
{ | ||
public static class ToFormatExtension | ||
{ | ||
public static string ToFormat(this Big big, FormatOptions? fmt = null) => ToFormat(big, null, null, fmt); | ||
public static string ToFormat(this Big big, long? dp, FormatOptions? fmt = null) => ToFormat(big, dp, null, fmt); | ||
public static string ToFormat(this Big big, long? dp, RoundingMode? rm, FormatOptions? fmt = null) | ||
{ | ||
if (!big.e.IsTrue() && big.e != 0) return big.ToString(); | ||
|
||
var arr = big.ToFixed(dp, rm).Split('.'); | ||
return ToFormatSharp.Core.ToFormatExtension.ToFormat(() => big.ToString(), arr, big.e, big.s, fmt); | ||
} | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
DecimalSharp.Light.ToFormat/DecimalSharp.Light.ToFormat.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
<GeneratePackageOnBuild>True</GeneratePackageOnBuild> | ||
<Version>1.0.0</Version> | ||
<Authors>XeroXP</Authors> | ||
<Description>Adds a ToFormat instance method to BigDecimalLight.</Description> | ||
<Copyright>Copyright (c) $(Authors) 2022</Copyright> | ||
<PackageProjectUrl>https://github.com/XeroXP/ToFormatSharp</PackageProjectUrl> | ||
<PackageReadmeFile>README.md</PackageReadmeFile> | ||
<RepositoryUrl>https://github.com/XeroXP/ToFormatSharp.git</RepositoryUrl> | ||
<RepositoryType>git</RepositoryType> | ||
<PackageTags>format, formatting</PackageTags> | ||
<PackageLicenseFile>LICENSE</PackageLicenseFile> | ||
<PackageRequireLicenseAcceptance>False</PackageRequireLicenseAcceptance> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<None Include="..\README.md"> | ||
<Pack>True</Pack> | ||
<PackagePath>\</PackagePath> | ||
</None> | ||
<None Include="..\LICENSE"> | ||
<Pack>True</Pack> | ||
<PackagePath>\</PackagePath> | ||
</None> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="DecimalSharp.Light" Version="1.0.0" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\ToFormatSharp.Core\ToFormatSharp.Core.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using DecimalSharp.Core; | ||
using ToFormatSharp.Core; | ||
using ToFormatSharp.Core.Extensions; | ||
|
||
namespace DecimalSharp.Light.ToFormat | ||
{ | ||
public static class ToFormatExtension | ||
{ | ||
public static string ToFormat(this BigDecimalLight bigDecimal, FormatOptions? fmt = null) => ToFormat(bigDecimal, null, null, fmt); | ||
public static string ToFormat(this BigDecimalLight bigDecimal, long? dp, FormatOptions? fmt = null) => ToFormat(bigDecimal, dp, null, fmt); | ||
public static string ToFormat(this BigDecimalLight bigDecimal, long? dp, RoundingMode? rm, FormatOptions? fmt = null) | ||
{ | ||
if (!bigDecimal.e.IsTrue() && bigDecimal.e != 0) return bigDecimal.ToString(); | ||
|
||
var arr = bigDecimal.ToFixed(dp, rm).Split('.'); | ||
return ToFormatSharp.Core.ToFormatExtension.ToFormat(() => bigDecimal.ToString(), arr, bigDecimal.e, bigDecimal.s, fmt); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
<GeneratePackageOnBuild>True</GeneratePackageOnBuild> | ||
<Version>1.0.0</Version> | ||
<Authors>XeroXP</Authors> | ||
<Description>Adds a ToFormat instance method to BigDecimal.</Description> | ||
<Copyright>Copyright (c) $(Authors) 2022</Copyright> | ||
<PackageProjectUrl>https://github.com/XeroXP/ToFormatSharp</PackageProjectUrl> | ||
<PackageReadmeFile>README.md</PackageReadmeFile> | ||
<RepositoryUrl>https://github.com/XeroXP/ToFormatSharp.git</RepositoryUrl> | ||
<RepositoryType>git</RepositoryType> | ||
<PackageTags>format, formatting</PackageTags> | ||
<PackageLicenseFile>LICENSE</PackageLicenseFile> | ||
<PackageRequireLicenseAcceptance>False</PackageRequireLicenseAcceptance> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<None Include="..\README.md"> | ||
<Pack>True</Pack> | ||
<PackagePath>\</PackagePath> | ||
</None> | ||
<None Include="..\LICENSE"> | ||
<Pack>True</Pack> | ||
<PackagePath>\</PackagePath> | ||
</None> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="DecimalSharp" Version="1.0.0" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\ToFormatSharp.Core\ToFormatSharp.Core.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using DecimalSharp.Core; | ||
using ToFormatSharp.Core; | ||
using ToFormatSharp.Core.Extensions; | ||
|
||
namespace DecimalSharp.ToFormat | ||
{ | ||
public static class ToFormatExtension | ||
{ | ||
public static string ToFormat(this BigDecimal bigDecimal, FormatOptions? fmt = null) => ToFormat(bigDecimal, null, null, fmt); | ||
public static string ToFormat(this BigDecimal bigDecimal, long? dp, FormatOptions? fmt = null) => ToFormat(bigDecimal, dp, null, fmt); | ||
public static string ToFormat(this BigDecimal bigDecimal, long? dp, RoundingMode? rm, FormatOptions? fmt = null) | ||
{ | ||
if (!bigDecimal.e.IsTrue() && bigDecimal.e != 0) return bigDecimal.ToString(); | ||
|
||
var arr = bigDecimal.ToFixed(dp, rm).Split('.'); | ||
return ToFormatSharp.Core.ToFormatExtension.ToFormat(() => bigDecimal.ToString(), arr, bigDecimal.e, bigDecimal.s, fmt); | ||
} | ||
} | ||
} |
Oops, something went wrong.