/// <summary> /// Compares the specified <see cref="T:System.String"/> values. /// /// </summary> /// <param name="first">The first object of type <see cref="T:System.String"/> to compare. /// </param><param name="second">The second object of type <see cref="T:System.String"/> to compare. /// </param><param name="conditionOperatorId">The condition operator identifier. /// </param> /// <returns> /// <c>true</c> if the specified <see cref="T:System.String"/> values are equal; otherwise, <c>false</c>. /// /// </returns> internal static bool CompareStrings(string first, string second, string conditionOperatorId) { Assert.ArgumentNotNull((object)first, "first"); Assert.ArgumentNotNull((object)second, "second"); switch (ConditionsUtility.GetStringConditionOperatorById(conditionOperatorId)) { case StringConditionOperator.Equals: return(first == second); case StringConditionOperator.CaseInsensitivelyEquals: return(string.Compare(first, second, StringComparison.CurrentCultureIgnoreCase) == 0); case StringConditionOperator.NotEqual: return(first != second); case StringConditionOperator.NotCaseInsensitivelyEquals: return(string.Compare(first, second, StringComparison.CurrentCultureIgnoreCase) != 0); case StringConditionOperator.Contains: return(first.IndexOf(second, StringComparison.CurrentCultureIgnoreCase) >= 0); case StringConditionOperator.MatchesRegularExpression: return(Regex.IsMatch(first, second)); case StringConditionOperator.StartsWith: return(first.StartsWith(second, StringComparison.CurrentCultureIgnoreCase)); case StringConditionOperator.EndsWith: return(first.EndsWith(second, StringComparison.CurrentCultureIgnoreCase)); default: return(false); } }
/// <summary> /// Gets the <see cref="T:System.Int32"/> comparer. /// /// </summary> /// <param name="conditionOperatorId">The condition operator identifier. /// </param> /// <returns> /// The <see cref="T:System.Func`3"/>. /// /// </returns> internal static Func <int, int, bool> GetInt32Comparer(string conditionOperatorId) { return(ConditionsUtility.GetInt32Comparer(ConditionsUtility.GetConditionOperatorById(conditionOperatorId))); }