Re: How to check variables for uniqueness ?



John W. Kennedy wrote:
No, but toUpperCase translates "ß" to "SS" because that is the only uppercase that "ß" has. It doesn't work the other way because "SS" can be either "ss" or "ß", depending on the word. This is documented behavior.

Just because a behavior is documented doesn't mean it isn't broken. Either:

*equalsIgnoreCase should consider all these spelling variants equal,
*toUpperCase should leave ß alone, e.g. Beißen -> BEIßEN while a toAllCapsTitle or similar makes it BEISSEN, or
*the behavior should be based on the system default locale, with versions of all the methods that accept a Locale and use it in place of the system default, consistency among equalsIgnoreCase, toUpperCase, and toLowerCase for a given locale, and unsurprising behavior to people from that locale.

Independently of which, a bunch of these methods and others around the system need renaming for case consistency in a very different way -- a bunch of Java methods don't follow the usual camelCase convention. A partial list seems to include

String.toUppercase (should be toUpperCase)
String.toLowercase (analogously; and equalsIgnoreCase is already as it should be!)
Character.isWhitespace (isWhiteSpace)
System.arraycopy (arrayCopy)

That's at least four where the start of a non-initial word isn't capitalized (case, case, space, and copy, respectively).

These are an endless source of fun compile errors and debugging sessions and really they shouldn't be. Even in eclipse, they manage to annoy without being so extreme, and also hinder documentation search and completion (put System.arrayc, try to autocomplete it, and it balks; try to view the documentation to see if there's something you've missed and it also balks; eclipse could definitely use case-insensitive completion when there's no ambiguity as a result of case-insensitivity).

Another fun one:

HttpURLConnection

Really, it should be HTTPURLConnection or HttpUrlConnection, probably the former. HTTPConnection would be best, since it's certainly a network (i.e. URL) connection. :P
.



Relevant Pages

  • Change in gnome-doc-utils.make file
    ... # gnome-doc-utils.make - make magic for building documentation ... .PHONY: clean-doc-header ... ## The generated rngdoc documentation in the C locale ... # FIXME: Fix the dependancies ...
    (GNOME)
  • Re: Locale independant way to process special chars
    ... > Tho my documentation tells me that 'for iswalpha, ... > condition is independent of locale', it still returns 0 for the Umlaut a. ...
    (comp.lang.cpp)
  • Re: GD filehandle problem
    ... Then perhaps it's time to update yourself on the documentation. ... My hunch would be that you're using a version of Perl whose unicode ... support is sensitive to locale, and you've got utf-8 in your locale. ...
    (comp.lang.perl.misc)
  • Re: Precision lost when running gawk program from bat file
    ... It's almost certainly related to your locale setting. ... Visa citerad text - ... If it's not in your OS documentation, you stand a better chance of getting the ... this case with GNU awk, as we discovered you'll get a different answer if you're ...
    (comp.lang.awk)
  • Re: Date and Calendat.getTime() not the same exact freaking thing?
    ... returned is based on the current time in the default time zone with ... the default locale." ... The time of the writing of the documentation ... You must be a blast at parties. ...
    (comp.lang.java.programmer)