Re: How to check variables for uniqueness ?




"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".

- Oliver


.



Relevant Pages