aboutsummaryrefslogtreecommitdiff
path: root/libjava/java/lang/String.java
diff options
context:
space:
mode:
authorTom Tromey <tromey@cygnus.com>2000-11-18 02:29:13 +0000
committerTom Tromey <tromey@gcc.gnu.org>2000-11-18 02:29:13 +0000
commit9839499072cebd19a8c5cc2a3734adf60b06b21b (patch)
tree172790643762236160d84d128d568d37d0b773ac /libjava/java/lang/String.java
parentc5f651bf3ff1ec27c25ebdcd14d55bc125c020a4 (diff)
downloadgcc-9839499072cebd19a8c5cc2a3734adf60b06b21b.zip
gcc-9839499072cebd19a8c5cc2a3734adf60b06b21b.tar.gz
gcc-9839499072cebd19a8c5cc2a3734adf60b06b21b.tar.bz2
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
Diffstat (limited to 'libjava/java/lang/String.java')
-rw-r--r--libjava/java/lang/String.java34
1 files changed, 26 insertions, 8 deletions
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 <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 ();