From 9839499072cebd19a8c5cc2a3734adf60b06b21b Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sat, 18 Nov 2000 02:29:13 +0000 Subject: natString.cc: Include Locale.h. * 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. From-SVN: r37539 --- libjava/java/lang/String.java | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) (limited to 'libjava/java/lang/String.java') diff --git a/libjava/java/lang/String.java b/libjava/java/lang/String.java index bc21afd..22e1153 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 @@ -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 (); -- cgit v1.1