public void SetMode(MatchValueHandling m) => Mode = m;
public SearchOptions WithMode(MatchValueHandling m) { SetMode(m); return(this); }
public static bool Matches(this string s, string input, MatchHandling m = MatchHandling.Match, MatchValueHandling v = MatchValueHandling.Equals) { s = (m == MatchHandling.Exact) ? s : s.ToString().CaseAs(CaseFormat.Lowercase); input = (m == MatchHandling.Exact) ? input : input.CaseAs(CaseFormat.Lowercase); bool success = false; switch (v) { case MatchValueHandling.StartsWith: success = s.StartsWith(input); break; case MatchValueHandling.EndsWith: success = s.EndsWith(input); break; case MatchValueHandling.Contains: success = s.Contains(input); break; default: success = s == input; break; } return(success); }
public void SetSearchMethod(MatchValueHandling match) => SearchHandling = match;
public static IEnumerable <TSource> Search <TSource, TKey>(this IEnumerable <TSource> t, Func <TSource, TKey> k, string v, MatchValueHandling m = MatchValueHandling.Equals, CaseFormat c = CaseFormat.Ignore) => t.Search(k, new SearchOptions(v, m, c));