-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The Equals
validation rule is case insensitive when comparing string
values
#169
Comments
What about adding an optional column to the validation table? If you don't add the extra value to the validation row, then it defaults to case insensitive; otherwise, you can specify whether it is case sensitive? |
@NickMcG, yes, that is another option. :) The only "drawback" with that approach is the column doesn't apply for all the rules like I would also consider the definition of "equals" to be "==" which is case sensitive for string comparisons by default in .NET and JavaScript for example. |
The fact that Contains and DoesNotContain are different are limitations of the .NET framework. There's no case insensitive comparison for it unfortunately. Everything else is case-insensitive as most of the feedback I've received from people over the years is they don't want to be tangled up by someone changing the case of a letter. I can update the documentation to reflect that these comparisons are case insensitive. What's your use case for needing case sensitivity? |
My specific use case is when dealing with abbreviations for file sizes. For example, Another use case is related to file names which in Windows 10 build 17093 (April 2018 Update) can now be made case sensitive. Here is some code with a case insensitive Thank you. |
FWIW, the element selector in |
Hi.
The description of the
Equals
validation rule on https://github.com/dpiessens/specbind/wiki/Verifying-Steps indicatesSo I expected that a comparison of the string values
test
andTest
to fail.The unexpected behavior also exists in the
NotEquals
,StartsWith
, andEndsWith
comparers.This is inconsistent with the
Contains
andDoesNotContain
comparers which are case sensitive.One solution could be to create new validation rules to differentiate between the case sensitivity comparison.
For example:
Another option is to create a SpecBind configuration setting that defines the sensitivity option during string comparisons.
It seems the only benefit of having the additional validation rules is the flexibility when comparing strings in multiple scenarios with mixed sensitivity within the same project.
I prefer string comparisons to be case sensitive by default.
I expect the
Equals
,NotEquals
,StartsWith
, andEndsWith
comparers to be case sensitive.I don't and I'm not sure who else has a need for case insensitive comparisons at the moment, so maybe we don't have to implement the
Equivalent
comparers (yet?).Thank you.
The text was updated successfully, but these errors were encountered: