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
This commit is contained in:
parent
c5f651bf3f
commit
9839499072
7 changed files with 327 additions and 159 deletions
|
@ -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 native String toUpperCase ();
|
||||
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 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 ();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue