33 lines
920 B
C#
33 lines
920 B
C#
|
|
namespace isnd.Helpers
|
||
|
|
{
|
||
|
|
public static class PackageIdHelpers
|
||
|
|
{
|
||
|
|
|
||
|
|
internal static bool SeparatedByMinusMatch(string id, string q)
|
||
|
|
{
|
||
|
|
foreach (var part in id.Split('-'))
|
||
|
|
{
|
||
|
|
if (part.StartsWith(q, System.StringComparison.OrdinalIgnoreCase)) return true;
|
||
|
|
}
|
||
|
|
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);
|
||
|
|
if (id.StartsWith(query, System.StringComparison.OrdinalIgnoreCase)) return true;
|
||
|
|
}
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
}
|