File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
src/System.Management.Automation/utils Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change 22// Licensed under the MIT License.
33
44using System ;
5- using System . Collections . Generic ;
5+ using System . Globalization ;
66
77namespace System . Management . Automation
88{
@@ -23,14 +23,17 @@ public static bool IsFuzzyMatch(string string1, string string2)
2323
2424
2525 /// <summary>
26- /// Compute the distance between two strings.
26+ /// Compute the case-insensitive distance between two strings.
2727 /// Based off https://www.csharpstar.com/csharp-string-distance-algorithm/.
2828 /// </summary>
2929 /// <param name="string1">The first string to compare.</param>
3030 /// <param name="string2">The second string to compare.</param>
3131 /// <returns>The distance value where the lower the value the shorter the distance between the two strings representing a closer match.</returns>
3232 public static int GetDamerauLevenshteinDistance ( string string1 , string string2 )
3333 {
34+ string1 = string1 . ToUpper ( CultureInfo . CurrentCulture ) ;
35+ string2 = string2 . ToUpper ( CultureInfo . CurrentCulture ) ;
36+
3437 var bounds = new { Height = string1 . Length + 1 , Width = string2 . Length + 1 } ;
3538
3639 int [ , ] matrix = new int [ bounds . Height , bounds . Width ] ;
You can’t perform that action at this time.
0 commit comments