Search code examples
sitecoresitecore8

Sitecore - What is the different between "is equal to", "is case-insensitively equal to" and "is not case-insensitively equal to"?


In Sitecore, I am trying to create segmented list in the Line Manager. However, when I select the condition, I get so confuse with "is equal to", "is case-insensitively equal to" and "is not case-insensitively equal to"?

enter image description here

Can anyone explain the difference to me?

Thanks!


Solution

  • Below the code used by Sitecore for Equals, CaseInsensitivelyEquals, NotEqual and NotCaseInsensitivelyEquals operators:

    case StringConditionOperator.Equals:
        return first == second;
    case StringConditionOperator.CaseInsensitivelyEquals:
        return string.Compare(first, second, System.StringComparison.CurrentCultureIgnoreCase) == 0;
    case StringConditionOperator.NotEqual:
        return first != second;
    case StringConditionOperator.NotCaseInsensitivelyEquals:
        return string.Compare(first, second, System.StringComparison.CurrentCultureIgnoreCase) != 0;