Skip to content

Commit

Permalink
Fixed thousand separator should respect the provided CultureInfo. Closes
Browse files Browse the repository at this point in the history
 #14

Bumped version. Added license in csproj/nupkg.
  • Loading branch information
andersnm committed Mar 21, 2019
1 parent c997e89 commit ff914bc
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/ExcelNumberFormat/ExcelNumberFormat.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<TargetFrameworks>net20;netstandard1.0</TargetFrameworks>
<VersionPrefix>1.0.4</VersionPrefix>
<VersionPrefix>1.0.5</VersionPrefix>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Description>.NET library to parse ECMA-376 number format strings and format values like Excel and other spreadsheet softwares.</Description>
Expand All @@ -13,6 +13,7 @@
<AssemblyOriginatorKeyFile>ExcelNumberFormat.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
</PropertyGroup>

</Project>
2 changes: 1 addition & 1 deletion src/ExcelNumberFormat/Formatter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ static void FormatThousandSeparator(string valueString, int digit, CultureInfo c
var positionInTens = valueString.Length - 1 - digit;
if (positionInTens > 0 && (positionInTens % 3) == 0)
{
result.Append(",");
result.Append(culture.NumberFormat.NumberGroupSeparator);
}
}

Expand Down
7 changes: 7 additions & 0 deletions test/ExcelNumberFormat.Tests/Class1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,13 @@ public void TestThousandSeparator()
Assert.AreEqual("0,001,469.07", actual);
}

[TestMethod]
public void TestThousandSeparatorCulture()
{
var actual = Format(1469.07, "0,000,000.00", new CultureInfo("da-DK"));
Assert.AreEqual("0.001.469,07", actual);
}

void TestValid(string format)
{
var to = new NumberFormat(format);
Expand Down

0 comments on commit ff914bc

Please sign in to comment.