|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.microedition.global.StringComparator
public final class StringComparator
Field Summary | ||
---|---|---|
static int |
IDENTICAL
Constant for the comparison level that takes all differences between characters into account. |
|
static int |
LEVEL1
Constant for the primary collation level. |
|
static int |
LEVEL2
Constant for the secondary collation level. |
|
static int |
LEVEL3
Constant for the tertiary collation level. |
Constructor Summary | ||
---|---|---|
StringComparator()
Constructs an instance using the default locale indicated by the microedition.locale system property, using the default collation level LEVEL1. |
||
StringComparator(String locale)
Constructs an instance using the specified locale and the default collation level LEVEL1. |
||
StringComparator(String locale,
int level)
Constructs an instance using the specified locale and collation level. |
Method Summary | ||
---|---|---|
int |
compare(String s1,
String s2)
Compares the two strings using the rules specific to the associated locale of this instance. |
|
boolean |
equals(String s1,
String s2)
Tests if the two strings are equal according to the rules specific to the associated locale of this instance. |
|
int |
getLevel()
Gets the current comparison level. |
|
String |
getLocale()
Gets the locale of this StringComparator. |
|
static String[] |
getSupportedLocales()
Gets the locales for which a StringComparator is available in this implementation. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int IDENTICAL
public static final int LEVEL1
public static final int LEVEL2
public static final int LEVEL3
Constructor Detail |
---|
public StringComparator()
UnsupportedLocaleException
- if the default locale is not supported by the StringComparator implementationpublic StringComparator(String locale)
locale
- the locale to use, or null to use the generic collation algorithm
UnsupportedLocaleException
- if the default locale is not supported by the StringComparator implementation
IllegalArgumentException
- if the specified locale is non-null but not valid according to the MIDP 2.0 specificationpublic StringComparator(String locale, int level)
locale
- the locale to use, or null to use the generic collation algorithmlevel
- the collation level to use
UnsupportedLocaleException
- if the default locale is not supported by the StringComparator implementation
IllegalArgumentException
- if the specified locale is non-null but not valid according to the MIDP 2.0 specificationMethod Detail |
---|
public int compare(String s1, String s2)
s1
- first string to compares2
- second string to compare
NullPointerException
- if either s1 or s2 is nullpublic boolean equals(String s1, String s2)
s1
- first string to compares2
- second string to compare
NullPointerException
- if either s1 or s2 is nullpublic int getLevel()
public String getLocale()
public static String[] getSupportedLocales()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal