Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.96 KB | None | 0 0
  1. var minPos = 500;
  2.  
  3.             foreach (var rule in TireBrand.RulesToApply)
  4.             {
  5.                 if (rule.Definition == null)
  6.                 {
  7.                     continue;
  8.                 }
  9.  
  10.                 var m = Regex.Match(
  11.                         TireBrand.ValueBefore,
  12.                         @rule.Definition,
  13.                         RegexOptions.IgnoreCase);
  14.  
  15.                 var matchfound = m.Success;
  16.  
  17.                 if (matchfound)
  18.                 {
  19.                     if (TireBrand.ValueBefore.ToUpper().IndexOf(m.Groups[0].Value.ToUpper()) < minPos)
  20.                     {
  21.                         result =
  22.                             (rule.DefaultMatchValue != null ?
  23.                             rule.DefaultMatchValue :
  24.                             m.Groups[0].Value);
  25.  
  26.                         minPos = TireBrand.ValueBefore.ToUpper().IndexOf(m.Groups[0].Value.ToUpper());
  27.                     }
  28.                 }
  29.             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement