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 2
2
// Licensed under the MIT License.
3
3
4
4
using System ;
5
- using System . Collections . Generic ;
5
+ using System . Globalization ;
6
6
7
7
namespace System . Management . Automation
8
8
{
@@ -23,14 +23,17 @@ public static bool IsFuzzyMatch(string string1, string string2)
23
23
24
24
25
25
/// <summary>
26
- /// Compute the distance between two strings.
26
+ /// Compute the case-insensitive distance between two strings.
27
27
/// Based off https://www.csharpstar.com/csharp-string-distance-algorithm/.
28
28
/// </summary>
29
29
/// <param name="string1">The first string to compare.</param>
30
30
/// <param name="string2">The second string to compare.</param>
31
31
/// <returns>The distance value where the lower the value the shorter the distance between the two strings representing a closer match.</returns>
32
32
public static int GetDamerauLevenshteinDistance ( string string1 , string string2 )
33
33
{
34
+ string1 = string1 . ToUpper ( CultureInfo . CurrentCulture ) ;
35
+ string2 = string2 . ToUpper ( CultureInfo . CurrentCulture ) ;
36
+
34
37
var bounds = new { Height = string1 . Length + 1 , Width = string2 . Length + 1 } ;
35
38
36
39
int [ , ] matrix = new int [ bounds . Height , bounds . Width ] ;
You can’t perform that action at this time.
0 commit comments