public static bool CheckBracketsIntersect(string a, string b) { if (string.IsNullOrEmpty(a) || string.IsNullOrEmpty(b)) { return(false); } var bracketA = new NumBracket(a); var bracketB = new NumBracket(b); return(bracketA.Intersects(bracketB)); }
public bool Intersects(NumBracket other) { if (Start == null) { return(false); } if (End == null) { return(Start > other.Start && Start < other.End); } return(other.Start >= Start && other.Start <= End || other.End >= Start && other.End <= End); }