diff options
| author | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-11-18 02:29:13 +0000 |
|---|---|---|
| committer | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-11-18 02:29:13 +0000 |
| commit | 89d13b80877beb64917393da56c3cead4dd152c8 (patch) | |
| tree | 172790643762236160d84d128d568d37d0b773ac /libjava/java/lang/String.java | |
| parent | 7087a5050b7f3d24bb5171874de7f666d0da815b (diff) | |
| download | gcc-89d13b80877beb64917393da56c3cead4dd152c8.tar.gz | |
* java/lang/natString.cc: Include Locale.h.
(toUpperCase): Added `locale' argument. Handle locale
sensitivity.
(toLowerCase): Added `locale' argument. Handle locale
sensitivity.
(ESSET, CAPITAL_S, SMALL_I, CAPITAL_I_WITH_DOT, SMALL_DOTLESS_I,
CAPITAL_I): New defines.
* java/lang/String.java (CASE_INSENSITIVE_ORDER): Now public and
final.
Import Locale.
(toUpperCase, toLowerCase): New methods. Variants which accept
locale now native.
* java/lang/ExceptionInInitializerError.java (printStackTrace):
New methods.
* java/util/PropertyPermission.java: Re-merged from Classpath.
* java/text/RuleBasedCollator.java (getCollationElementIterator):
New method.
* java/text/StringCharacterIterator.java: Reindented.
(setText): New method.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@37539 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/java/lang/String.java')
| -rw-r--r-- | libjava/java/lang/String.java | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/libjava/java/lang/String.java b/libjava/java/lang/String.java index bc21afd0404..22e11530f77 100644 --- a/libjava/java/lang/String.java +++ b/libjava/java/lang/String.java @@ -11,6 +11,7 @@ import java.io.UnsupportedEncodingException; import java.io.Serializable; import java.lang.Comparable; import java.util.Comparator; +import java.util.Locale; /** * @author Per Bothner <bothner@cygnus.com> @@ -31,13 +32,13 @@ public final class String implements Serializable, Comparable // but it will avoid showing up as a discrepancy when comparing SUIDs. private static final long serialVersionUID = -6849794470754667710L; - static Comparator CASE_INSENSITIVE_ORDER = new Comparator() + public static final Comparator CASE_INSENSITIVE_ORDER = new Comparator() + { + public int compare (Object o1, Object o2) { - public int compare (Object o1, Object o2) - { - return ((String) o1).compareToIgnoreCase ((String) o2); - } - }; + return ((String) o1).compareToIgnoreCase ((String) o2); + } + }; public String () { @@ -276,9 +277,26 @@ public final class String implements Serializable, Comparable public native String replace (char oldChar, char newChar); - public native String toLowerCase (); + public native String toLowerCase (Locale locale); + public native String toUpperCase (Locale locale); + + public String toLowerCase () + { + // The JDK is a bit confused about what to do here. If we pass in + // the default Locale then special Locale handling might be + // invoked. However, the docs also say that Character.toLowerCase + // rules here. We go with the latter. + return toLowerCase (null); + } - public native String toUpperCase (); + public String toUpperCase () + { + // The JDK is a bit confused about what to do here. If we pass in + // the default Locale then special Locale handling might be + // invoked. However, the docs also say that Character.toLowerCase + // rules here. We go with the latter. + return toUpperCase (null); + } public native String trim (); |
