java.lang
Class String
java.lang.Object
java.lang.String
- All Implemented Interfaces:
- Serializable, CharSequence, Comparable
public final class String
- extends Object
- implements CharSequence, Comparable, Serializable
Standard string representation, as specified by the standard Java API.
Compliance: CLDC: 1.0 incomplete
- incorrect toLowerCase(): doesn't quite do all of Unicode
- incorrect toUpperCase(): doesn't quite do all of Unicode
Compliance: J2SE: 1.4 incomplete
- See Also:
- Serialized Form
|
Constructor Summary |
String()
|
String(byte[] bytes)
|
String(byte[] ascii,
int hibyte)
|
String(byte[] bytes,
int offset,
int length)
|
String(byte[] ascii,
int hibyte,
int offset,
int count)
|
String(byte[] bytes,
int offset,
int length,
String charsetName)
|
String(byte[] bytes,
String charsetName)
|
String(char[] value)
|
String(char[] value,
int offset,
int count)
|
String(String value)
|
String(StringBuffer buffer)
|
|
Method Summary |
char |
charAt(int index)
|
int |
compareTo(Object obj)
|
int |
compareTo(String s)
|
int |
compareToIgnoreCase(String str)
|
String |
concat(String str)
|
boolean |
contentEquals(StringBuffer sb)
|
static String |
copyValueOf(char[] data)
|
static String |
copyValueOf(char[] data,
int offset,
int count)
|
boolean |
endsWith(String suffix)
|
boolean |
equals(Object anObject)
|
boolean |
equalsIgnoreCase(String anotherString)
|
byte[] |
getBytes()
|
void |
getBytes(int srcBegin,
int srcEnd,
byte[] dst,
int dstBegin)
|
byte[] |
getBytes(String charsetName)
|
void |
getChars(int srcBegin,
int srcEnd,
char[] dst,
int dstBegin)
|
int |
hashCode()
|
int |
indexOf(int ch)
|
int |
indexOf(int ch,
int fromIndex)
|
int |
indexOf(String s)
|
int |
indexOf(String str,
int fromIndex)
|
String |
intern()
|
int |
lastIndexOf(int ch)
|
int |
lastIndexOf(int ch,
int fromIndex)
|
int |
lastIndexOf(String str)
|
int |
lastIndexOf(String str,
int fromIndex)
|
int |
length()
|
boolean |
matches(String regex)
|
boolean |
regionMatches(boolean ignoreCase,
int toffset,
String other,
int ooffset,
int len)
|
boolean |
regionMatches(int toffset,
String other,
int ooffset,
int len)
|
String |
replace(char oldChar,
char newChar)
|
String |
replaceAll(String regex,
String replacement)
|
String |
replaceFirst(String regex,
String replacement)
|
String[] |
split(String regex)
|
String[] |
split(String regex,
int limit)
|
boolean |
startsWith(String s)
|
boolean |
startsWith(String prefix,
int toffset)
|
CharSequence |
subSequence(int beginIndex,
int endIndex)
|
String |
substring(int beginIndex)
|
String |
substring(int beginIndex,
int endIndex)
|
char[] |
toCharArray()
|
String |
toLowerCase()
|
String |
toLowerCase(Locale locale)
|
String |
toString()
|
String |
toUpperCase()
|
String |
toUpperCase(Locale locale)
|
String |
trim()
|
static String |
valueOf(boolean b)
|
static String |
valueOf(char c)
|
static String |
valueOf(char[] data)
|
static String |
valueOf(char[] data,
int offset,
int count)
|
static String |
valueOf(double d)
|
static String |
valueOf(float f)
|
static String |
valueOf(int i)
|
static String |
valueOf(long l)
|
static String |
valueOf(Object obj)
|
CASE_INSENSITIVE_ORDER
public static final Comparator CASE_INSENSITIVE_ORDER
String
public String()
String
public String(String value)
String
public String(char[] value)
String
public String(char[] value,
int offset,
int count)
String
public String(byte[] ascii,
int hibyte,
int offset,
int count)
String
public String(byte[] ascii,
int hibyte)
String
public String(byte[] bytes,
int offset,
int length,
String charsetName)
throws UnsupportedEncodingException
- Throws:
UnsupportedEncodingException
String
public String(byte[] bytes,
String charsetName)
throws UnsupportedEncodingException
- Throws:
UnsupportedEncodingException
String
public String(byte[] bytes,
int offset,
int length)
String
public String(byte[] bytes)
String
public String(StringBuffer buffer)
length
public int length()
- Specified by:
length in interface CharSequence
charAt
public char charAt(int index)
- Specified by:
charAt in interface CharSequence
getChars
public void getChars(int srcBegin,
int srcEnd,
char[] dst,
int dstBegin)
getBytes
public void getBytes(int srcBegin,
int srcEnd,
byte[] dst,
int dstBegin)
getBytes
public byte[] getBytes(String charsetName)
throws UnsupportedEncodingException
- Throws:
UnsupportedEncodingException
getBytes
public byte[] getBytes()
equals
public boolean equals(Object anObject)
- Overrides:
equals in class Object
contentEquals
public boolean contentEquals(StringBuffer sb)
equalsIgnoreCase
public boolean equalsIgnoreCase(String anotherString)
compareTo
public int compareTo(String s)
compareTo
public int compareTo(Object obj)
- Specified by:
compareTo in interface Comparable
compareToIgnoreCase
public int compareToIgnoreCase(String str)
regionMatches
public boolean regionMatches(int toffset,
String other,
int ooffset,
int len)
regionMatches
public boolean regionMatches(boolean ignoreCase,
int toffset,
String other,
int ooffset,
int len)
startsWith
public boolean startsWith(String s)
startsWith
public boolean startsWith(String prefix,
int toffset)
endsWith
public boolean endsWith(String suffix)
hashCode
public int hashCode()
- Overrides:
hashCode in class Object
indexOf
public int indexOf(int ch)
indexOf
public int indexOf(int ch,
int fromIndex)
lastIndexOf
public int lastIndexOf(int ch)
lastIndexOf
public int lastIndexOf(int ch,
int fromIndex)
indexOf
public int indexOf(String s)
indexOf
public int indexOf(String str,
int fromIndex)
lastIndexOf
public int lastIndexOf(String str)
lastIndexOf
public int lastIndexOf(String str,
int fromIndex)
substring
public String substring(int beginIndex)
substring
public String substring(int beginIndex,
int endIndex)
subSequence
public CharSequence subSequence(int beginIndex,
int endIndex)
- Specified by:
subSequence in interface CharSequence
concat
public String concat(String str)
replace
public String replace(char oldChar,
char newChar)
matches
public boolean matches(String regex)
replaceFirst
public String replaceFirst(String regex,
String replacement)
replaceAll
public String replaceAll(String regex,
String replacement)
split
public String[] split(String regex,
int limit)
split
public String[] split(String regex)
toLowerCase
public String toLowerCase(Locale locale)
toLowerCase
public String toLowerCase()
toUpperCase
public String toUpperCase(Locale locale)
toUpperCase
public String toUpperCase()
trim
public String trim()
toString
public String toString()
- Specified by:
toString in interface CharSequence- Overrides:
toString in class Object
toCharArray
public char[] toCharArray()
intern
public String intern()
valueOf
public static String valueOf(Object obj)
valueOf
public static String valueOf(char[] data)
valueOf
public static String valueOf(char[] data,
int offset,
int count)
copyValueOf
public static String copyValueOf(char[] data)
copyValueOf
public static String copyValueOf(char[] data,
int offset,
int count)
valueOf
public static String valueOf(boolean b)
valueOf
public static String valueOf(char c)
valueOf
public static String valueOf(int i)
valueOf
public static String valueOf(long l)
valueOf
public static String valueOf(float f)
valueOf
public static String valueOf(double d)