aboutsummaryrefslogtreecommitdiff
path: root/libjava/java/lang/String.java
diff options
context:
space:
mode:
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 ();