Re: How to check variables for uniqueness ?



Oliver Wong wrote:
"John Ersatznom" <j.ersatz@xxxxxxxxxxxxxxx> wrote in message news:eno52u$m8c$1@xxxxxxxxxxx

Oliver Wong wrote:

I thought you were curious as to how manually doing case-insensitive conversions could fail, as opposed to using the build in equalsIgnoreCase().

Both will fail when you want words spelled differently to compare equal,
though Collator may have more smarts in that area.


I don't know how you define "fail" or "not fail" in this context, but the point that I'm trying to make is that the two methods do not give the same results and are thus not equivalent. Try running the example I provided earlier, or try this example:

{
System.out.println("beißen".equalsIgnoreCase("BEISSEN"));
System.out.println("beißen".toUpperCase().equals("BEISSEN"));
}


"COLOR" and "colour" differ only by capitalization while "beissen" and "beißen" differ by spelling in a manner similar to "color" vs. "colour".

I disagree.

On what basis?

Replace the "beißen" by "colour" and "BEISSEN" by "COLOR", and you will see get different results, thus showing that the difference between "COLOR" and "colour" is not of the same nature as that between "beißen" and "BEISSEN".

This may show that it is "not of the same nature" as defined by certain Java library functions, but I don't see how this is really meaningful to people, except insofar as it "means" that the standard library has a bug or at least a wart or misfeature of some kind. The "equalsIgnoreCase" method should ignore case, but not spelling. It shouldn't consider "color" equal to "colour" and it shouldn't consider "beißen" equal to "beissen" either. Why? Because those pairs differ by spelling and not just capitalization!
.



Relevant Pages

  • Re: test
    ... >> testnig 123 ... that and they failed the spelling part of the test. ... Hardware, n.: The parts of a computer system that can be kicked ...
    (alt.linux)
  • Re: spelling test
    ... spelling and never fail to check a dictionary when in doubt. ... The other kids ... probably still beat you up after lunch." ...
    (uk.education.staffroom)