Skip to content

Commit 43975b7

Browse files
committed
Use invariant culture
1 parent 7c205fe commit 43975b7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Microsoft.Toolkit.Uwp.UI.Animations/Extensions/System/FloatExtensions.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ internal static class FloatExtensions
1919
[Pure]
2020
public static string ToCompositionString(this float number)
2121
{
22-
var defaultString = number.ToString();
22+
var defaultString = number.ToString(System.Globalization.CultureInfo.InvariantCulture);
2323
var eIndex = defaultString.IndexOf('E');
2424

2525
// If the default string representation is not in scientific notation, we can use it
@@ -32,7 +32,7 @@ public static string ToCompositionString(this float number)
3232
var exponent = int.Parse(defaultString.Substring(eIndex + 1));
3333
if (exponent >= 0)
3434
{
35-
return number.ToString($"F0");
35+
return number.ToString($"F0", System.Globalization.CultureInfo.InvariantCulture);
3636
}
3737

3838
// Otherwise, we need to print it with the right number of decimals
@@ -42,7 +42,7 @@ public static string ToCompositionString(this float number)
4242
-3 : // Minus the sign, dot and first number of the mantissa if negative
4343
-2); // Minus the dot and first number of the mantissa otherwise
4444

45-
return number.ToString($"F{decimalPlaces}");
45+
return number.ToString($"F{decimalPlaces}", System.Globalization.CultureInfo.InvariantCulture);
4646
}
4747
}
4848
}

0 commit comments

Comments
 (0)