예제 #1
0
 public void SetMode(MatchValueHandling m)
 => Mode = m;
예제 #2
0
 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);
        }
예제 #4
0
 public void SetSearchMethod(MatchValueHandling match)
 => SearchHandling = match;
예제 #5
0
 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));