diff --git a/src/libraries/System.Runtime/tests/System/DoubleTests.cs b/src/libraries/System.Runtime/tests/System/DoubleTests.cs index a80eb05598c7ed..79bbac49432519 100644 --- a/src/libraries/System.Runtime/tests/System/DoubleTests.cs +++ b/src/libraries/System.Runtime/tests/System/DoubleTests.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Globalization; using System.IO; +using System.Linq; using Xunit; #pragma warning disable xUnit1025 // reporting duplicate test cases due to not distinguishing 0.0 from -0.0, NaN from -NaN @@ -349,15 +350,12 @@ public static void Parse(string value, NumberStyles style, IFormatProvider provi internal static string SplitPairs(string input) { - string[] splitPairs = input.Split('-'); - string ret = ""; - foreach (var pair in splitPairs) + if (!BitConverter.IsLittleEndian) { - string reversedPair = Reverse(pair); - ret += reversedPair; + return input.Replace("-", ""); } - return ret; + return string.Concat(input.Split('-').Select(pair => Reverse(pair))); } internal static string Reverse(string s)