isn/src/isnd/Helpers/PackageIdHelpers.cs

32 lines
903 B
C#
Raw Normal View History

2021-09-05 15:44:47 +01:00
namespace isnd.Helpers
{
public static class PackageIdHelpers
{
internal static bool SeparatedByMinusMatch(string id, string q)
{
foreach (var part in id.Split('-'))
{
2022-10-15 18:26:55 +01:00
if (part.Equals(q, System.StringComparison.OrdinalIgnoreCase)) return true;
2021-09-05 15:44:47 +01:00
}
return false;
}
internal static bool CamelCaseMatch(string id, string query)
{
// Assert.False (q==null);
if (string.IsNullOrEmpty(query)) return true;
while (id.Length > 0)
{
int i = 0;
while (id.Length > i && char.IsLower(id[i])) i++;
if (i == 0) break;
id = id.Substring(i);
2022-10-15 18:26:55 +01:00
if (id.Equals(query, System.StringComparison.OrdinalIgnoreCase)) return true;
2021-09-05 15:44:47 +01:00
}
return false;
}
}
}