Re: How to check variables for uniqueness ?




"John Ersatznom" <j.ersatz@xxxxxxxxxxxxxxx> wrote in message
news:eninf3$5i6$2@xxxxxxxxxxx
Oliver Wong wrote:
"John Ersatznom" <j.ersatz@xxxxxxxxxxxxxxx> wrote in message
news:en3as3$p8d$2@xxxxxxxxxxx

Oliver Wong wrote:

assert locale is German; //pseudcode
assert "BEISSEN".toLowerCase().equals("beissen");
assert "BEISSEN".toLowerCase().equals("beißen");

Yeah, and assert "Color".toLowerCase().equals("Colour".toLowerCase()).


{
String originalA = "color";
a = originalA; // "color"
a = a.toUppercase(); // "COLOR"
a = a.toLowercase(); // "color"
assert a.equals(originalA);
}

I don't see "colour" (with a U) in there anywhere, Oliver.

You weren't intended to.

Then you're missing the point entirely.

Must be, because I was under the impression I was making a point to you,
as opposed to the other way around. I thought you were curious as to how
manually doing case-insensitive conversions could fail, as opposed to using
the build in equalsIgnoreCase().



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

Alternate spellings of the same word can't in general be idenfitied as
identical by a computer -- not without a trip through a spellchecking
dictionary or the like, anyway. I think you may be expecting too much of
Java's humble string classes. Perhaps Collator is smart enough for you?

You should take the code I posted and put it in your favorite IDE, fix
the compile errors (apparently, it's toLowerCase, not toLowercase), and run
it. You might find the results enlightening. If those results surprise you,
add a few System.out.println(a) to see what's going on.

- Oliver


.



Relevant Pages

  • Re: who can tell me why
    ... conventions just to be different or arbitrarily, ... missing out on some benefit. ... This argument assumes that it's clear to the OP that there is a consensus, and that the OP is willfully choosing to be contrary; perhaps in the OP's experience, both styles of declaration are equally common, thus explaining why the OP came to the conclusion that it was just a matter of preference. ... Oliver ...
    (comp.lang.java.programmer)
  • Re: Class names are put into executables !!!
    ... > Oliver, please stop telling me what is right or wrong for me. ... You are missing the point. ... They've been in Delphi since day one, ... Either that or buy some obfusticating tool ...
    (borland.public.delphi.non-technical)
  • Re: Class names are put into executables !!!
    ... Oliver Townshend wrote: ... >>I don't like the class names in the executables. ... > You are missing the point. ... They've been in Delphi since day one, ...
    (borland.public.delphi.non-technical)
  • Re: About Boxes
    ... >>What is it missing? ... > I got a response from MS. ... Prev by Date: ...
    (comp.lang.java.advocacy)