From 5e04c23e1e1329ef08cff8bc5bb586a0d82c3cc2 Mon Sep 17 00:00:00 2001 From: evinnichenko <77905640+evinnichenko@users.noreply.github.com> Date: Thu, 6 Jun 2024 19:31:45 -0700 Subject: [PATCH] Fixed bug with ,2 reading as 2 instead of .2 --- .../NumberTranslator.cs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Calculator/NumberTranslator.cs b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Calculator/NumberTranslator.cs index e739d6077c..9d82e45d0a 100644 --- a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Calculator/NumberTranslator.cs +++ b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Calculator/NumberTranslator.cs @@ -135,13 +135,10 @@ namespace Microsoft.PowerToys.Run.Plugin.Calculator { if (!string.IsNullOrEmpty(token)) { - if (char.IsDigit(token[0])) - { - var separatorRegex = new Regex(@"[^\d](?=.*[^\d])"); - token_bis = separatorRegex.Replace(token, string.Empty); - var separatorRegex2 = new Regex(@"[^\d]"); - token_bis = separatorRegex2.Replace(token_bis, cultureFrom.NumberFormat.NumberDecimalSeparator); - } + var separatorRegex = new Regex(@"[^\d](?=.*[^\d])"); + token_bis = separatorRegex.Replace(token, string.Empty); + var separatorRegex2 = new Regex(@"[^\d]"); + token_bis = separatorRegex2.Replace(token_bis, cultureFrom.NumberFormat.NumberDecimalSeparator); } }