diff --git a/src/System.Management.Automation/utils/FuzzyMatch.cs b/src/System.Management.Automation/utils/FuzzyMatch.cs index 0c99370c10..a99f9a5bf5 100644 --- a/src/System.Management.Automation/utils/FuzzyMatch.cs +++ b/src/System.Management.Automation/utils/FuzzyMatch.cs @@ -2,7 +2,7 @@ // Licensed under the MIT License. using System; -using System.Collections.Generic; +using System.Globalization; namespace System.Management.Automation { @@ -23,7 +23,7 @@ namespace System.Management.Automation /// - /// Compute the distance between two strings. + /// Compute the case-insensitive distance between two strings. /// Based off https://www.csharpstar.com/csharp-string-distance-algorithm/. /// /// The first string to compare. @@ -31,6 +31,9 @@ namespace System.Management.Automation /// The distance value where the lower the value the shorter the distance between the two strings representing a closer match. public static int GetDamerauLevenshteinDistance(string string1, string string2) { + string1 = string1.ToUpper(CultureInfo.CurrentCulture); + string2 = string2.ToUpper(CultureInfo.CurrentCulture); + var bounds = new { Height = string1.Length + 1, Width = string2.Length + 1 }; int[,] matrix = new int[bounds.Height, bounds.Width];