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