Re: How to check variables for uniqueness ?
- From: "Oliver Wong" <owong@xxxxxxxxxxxxxx>
- Date: Thu, 4 Jan 2007 16:26:56 -0500
"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
.
- Follow-Ups:
- Re: How to check variables for uniqueness ?
- From: John Ersatznom
- Re: How to check variables for uniqueness ?
- References:
- Re: How to check variables for uniqueness ?
- From: John Ersatznom
- Re: How to check variables for uniqueness ?
- Prev by Date: Re: systematic file(s) deletion
- Next by Date: Re: What classpath should I set so javac can find all those classes came with SDK?
- Previous by thread: Re: How to check variables for uniqueness ?
- Next by thread: Re: How to check variables for uniqueness ?
- Index(es):
Relevant Pages
|