in src/PSRule.Rules.Azure/LocationHelper.cs [15:50]
public static bool Equal(string location1, string location2)
{
if (string.IsNullOrEmpty(location1) && string.IsNullOrEmpty(location2))
return true;
if (string.IsNullOrEmpty(location1) || string.IsNullOrEmpty(location2))
return false;
var i = 0;
var j = 0;
while (i < location1.Length && j < location2.Length)
{
if (char.IsWhiteSpace(location1[i]))
i++;
if (char.IsWhiteSpace(location2[j]))
j++;
if (i == location1.Length && j == location2.Length)
return true;
if (i == location1.Length || j == location2.Length)
return false;
if (char.ToLowerInvariant(location1[i++]) != char.ToLowerInvariant(location2[j++]))
return false;
}
if (i < location1.Length && char.IsWhiteSpace(location1[i]))
i++;
if (j < location2.Length && char.IsWhiteSpace(location2[j]))
j++;
return i == location1.Length && j == location2.Length;
}