mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-01-20 16:03:17 +08:00
[PTRun][Calc]Add list separator handling for different cultures
This commit is contained in:
parent
809791da25
commit
6441fec614
@ -74,6 +74,7 @@ namespace Microsoft.PowerToys.Run.Plugin.Calculator.UnitTests
|
||||
[DataRow("5,2+6", "5.2+6")]
|
||||
[DataRow("round(2,5)", "round(2.5)")]
|
||||
[DataRow("3,3333", "3.3333")]
|
||||
[DataRow("max(2;3)", "max(2,3)")]
|
||||
public void Translate_NoErrors_WhenCalled(string input, string expectedResult)
|
||||
{
|
||||
// Arrange
|
||||
|
@ -123,7 +123,7 @@ namespace Microsoft.PowerToys.Run.Plugin.Calculator
|
||||
outputBuilder.Append(
|
||||
decimal.TryParse(token, NumberStyles.Number, cultureFrom, out number)
|
||||
? (new string('0', leadingZeroCount) + number.ToString(cultureTo))
|
||||
: token);
|
||||
: token.Replace(cultureFrom.TextInfo.ListSeparator, cultureTo.TextInfo.ListSeparator));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user