Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4125644

RFE: Improve locale handling in String.toLowerCase/toUpperCase

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Won't Fix
    • Icon: P4 P4
    • None
    • 1.2.0
    • core-libs
    • generic
    • generic

      In src/share/classes/java/lang/String.java, String.toLowerCase(Locale)
      (and String.toUpperCase(Locale)) start off with

      if (locale.getLanguage().equals("tr")) ...

      with some special code for the Turkish locale. Since we are already
      doing a dispatch to the locale, why not add toLowerCase(char[]) to
      the Locale API and let the locale do the conversion itself. There
      could be a default implementation that does the fast loop, but then
      the Turkish locale could have an overriding definition that does the
      dotted i transformation. Object oriented code! What a concept.

      The default implementation could use Character.toLowerCase just like
      now. Or the 8859-1 locale (I'm probably mixing types here) could
      special case 'A'..'Z' and rest of the ASCII subset not do the shifting
      and masking and 3 (count 'em, 3) array subscript operations in the
      usual case where you just have ASCII characters. Or you could push
      the ASCII special case code down into Character.toLowerCase and win
      for the other people that use that method.

      peter.kessler@Eng 1998-04-03

            okutsu Masayoshi Okutsu
            pbk Peter Kessler
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: