Skip to content

Commit ff914bc

Browse files
committed
Fixed thousand separator should respect the provided CultureInfo. Closes #14
Bumped version. Added license in csproj/nupkg.
1 parent c997e89 commit ff914bc

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

src/ExcelNumberFormat/ExcelNumberFormat.csproj

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

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

1819
</Project>

src/ExcelNumberFormat/Formatter.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ static void FormatThousandSeparator(string valueString, int digit, CultureInfo c
388388
var positionInTens = valueString.Length - 1 - digit;
389389
if (positionInTens > 0 && (positionInTens % 3) == 0)
390390
{
391-
result.Append(",");
391+
result.Append(culture.NumberFormat.NumberGroupSeparator);
392392
}
393393
}
394394

test/ExcelNumberFormat.Tests/Class1.cs

+7
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,13 @@ public void TestThousandSeparator()
430430
Assert.AreEqual("0,001,469.07", actual);
431431
}
432432

433+
[TestMethod]
434+
public void TestThousandSeparatorCulture()
435+
{
436+
var actual = Format(1469.07, "0,000,000.00", new CultureInfo("da-DK"));
437+
Assert.AreEqual("0.001.469,07", actual);
438+
}
439+
433440
void TestValid(string format)
434441
{
435442
var to = new NumberFormat(format);

0 commit comments

Comments
 (0)