in sdk/src/Core/Internal/Utils/StringExtension.cs [110:145]
private static bool SimpleWildcardMatch(string text, string pattern)
{
int j = 0;
int patternLength = pattern.Length;
int textLength = text.Length;
for (int i = 0; i < patternLength; i++)
{
char p = pattern[i];
if (p == '*')
{
// Presumption for this method is that glob can only occur at end.
return true;
}
if (p == '?')
{
if (j == text.Length)
{
return false; // No character to match
}
j++;
}
else
{
if (j >= text.Length || p != text[j])
{
return false;
}
j++;
}
}
return j == textLength;
}