|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.String
public final class String
An immutable string of characters.
Constructor Summary | |
---|---|
String()
|
|
String(byte[] b)
Create a String from a byte array |
|
String(byte[] b,
int hibyte)
Deprecated. |
|
String(byte[] b,
int off,
int len)
Create a String from a byte array |
|
String(byte[] b,
int hibyte,
int off,
int len)
Deprecated. |
|
String(byte[] b,
int off,
int len,
String charset)
Create a String from a byte array |
|
String(byte[] b,
String charset)
Create a String from a byte array |
|
String(char[] c)
Create a String from a character array |
|
String(char[] c,
int off,
int len)
Create a String from a character array. |
|
String(int[] codePoints,
int off,
int len)
|
|
String(String s)
|
|
String(StringBuffer sb)
|
|
String(StringBuilder sb)
|
Method Summary | |
---|---|
char |
charAt(int index)
Return the character at the given index |
int |
codePointAt(int index)
|
int |
codePointBefore(int index)
|
int |
codePointCount(int begin,
int end)
|
int |
compareTo(String str)
Compares this with another Object. |
String |
concat(String s)
|
boolean |
contentEquals(CharSequence s)
|
boolean |
contentEquals(StringBuffer sb)
|
static String |
copyValueOf(char[] data)
|
static String |
copyValueOf(char[] data,
int off,
int len)
|
boolean |
equals(Object other)
Compares the String with an Object |
boolean |
equalsIgnoreCase(String s)
|
byte[] |
getBytes()
|
void |
getBytes(int begin,
int end,
byte[] dst,
int off)
Deprecated. |
byte[] |
getBytes(String charset)
Get bytes in US Acsii |
void |
getChars(int start,
int end,
char[] buffer,
int off)
|
int |
hashCode()
Special version of hash that returns the same value the same String values |
int |
indexOf(int ch)
Find the index of a character. |
int |
indexOf(int ch,
int fromIndex)
Returns the index within this string of the first occurrence of the specified character, starting the search at the specified index. |
int |
indexOf(String str)
Finds the location of a string within this string |
int |
indexOf(String str,
int fromIndex)
Find location of String starting at a given index |
String |
intern()
|
boolean |
isEmpty()
Returns true, if and only if this string is of zero length. |
int |
lastIndexOf(char ch)
|
int |
lastIndexOf(char ch,
int fromIndex)
|
int |
lastIndexOf(String str)
Find the last occurrence of a String |
int |
lastIndexOf(String str,
int fromIndex)
Find last occurrence of s string from a given index |
int |
length()
Return the length of the String in characters |
int |
offsetByCodePoints(int idx,
int codePointCount)
|
String |
replace(char oldChar,
char newChar)
|
boolean |
startsWith(String s)
|
boolean |
startsWith(String s,
int begin)
|
CharSequence |
subSequence(int start,
int end)
|
String |
substring(int start)
Return substring from starting position to the end of the String |
String |
substring(int start,
int end)
Return substring from starting index to position before end index |
char[] |
toCharArray()
Converts the String into an array of characters |
String |
toLowerCase()
|
String |
toString()
Returns itself. |
String |
toUpperCase()
|
String |
trim()
|
static String |
valueOf(boolean b)
|
static String |
valueOf(char c)
|
static String |
valueOf(char[] c)
|
static String |
valueOf(char[] c,
int start,
int length)
|
static String |
valueOf(double d)
|
static String |
valueOf(float f)
|
static String |
valueOf(int i)
|
static String |
valueOf(long i)
|
static String |
valueOf(Object aObj)
Converts an Object to a String |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public String()
public String(byte[] b)
b
- the byte array@Deprecated public String(byte[] b, int hibyte)
b
- the byte arraypublic String(byte[] b, int off, int len)
b
- the byte array@Deprecated public String(byte[] b, int hibyte, int off, int len)
b
- the byte arraypublic String(byte[] b, int off, int len, String charset)
b
- the byte arraycharset
- ignored - assumed to be US ASCIIpublic String(byte[] b, String charset)
b
- the byte arraycharset
- ignored - assumed to be US ASCIIpublic String(char[] c)
c
- the character arraypublic String(char[] c, int off, int len)
c
- the character arrayoff
- the offset - usually 0len
- the length of the String - must not be greater than c.lengthpublic String(int[] codePoints, int off, int len)
public String(String s)
public String(StringBuffer sb)
public String(StringBuilder sb)
Method Detail |
---|
public char charAt(int index)
charAt
in interface CharSequence
public int codePointAt(int index)
public int codePointBefore(int index)
public int codePointCount(int begin, int end)
public int compareTo(String str)
Comparable
compareTo
in interface Comparable<String>
str
- the object to compare with
public String concat(String s)
public boolean contentEquals(CharSequence s)
public boolean contentEquals(StringBuffer sb)
public static String copyValueOf(char[] data)
public static String copyValueOf(char[] data, int off, int len)
public boolean equals(Object other)
equals
in class Object
public boolean equalsIgnoreCase(String s)
public byte[] getBytes()
@Deprecated public void getBytes(int begin, int end, byte[] dst, int off)
public byte[] getBytes(String charset)
charset
- ignored
public void getChars(int start, int end, char[] buffer, int off)
public int hashCode()
hashCode
in class Object
public int indexOf(int ch)
ch
- The character to find.
public int indexOf(int ch, int fromIndex)
ch
- a character (Unicode code point).fromIndex
- the index to start the search from.
fromIndex
, or -1
if
the character does not occur.public int indexOf(String str)
str
- the String
public int indexOf(String str, int fromIndex)
str
- the StringfromIndex
- the starting position
public String intern()
public boolean isEmpty()
public int lastIndexOf(char ch)
public int lastIndexOf(char ch, int fromIndex)
public int lastIndexOf(String str)
str
- the String
public int lastIndexOf(String str, int fromIndex)
str
- the StringfromIndex
- the starting point
public int length()
length
in interface CharSequence
public int offsetByCodePoints(int idx, int codePointCount)
public String replace(char oldChar, char newChar)
public boolean startsWith(String s)
public boolean startsWith(String s, int begin)
public CharSequence subSequence(int start, int end)
subSequence
in interface CharSequence
public String substring(int start)
start
- the starting position
public String substring(int start, int end)
start
- the start indexend
- the end index (not included)
public char[] toCharArray()
public String toLowerCase()
public String toUpperCase()
public String toString()
toString
in interface CharSequence
toString
in class Object
public String trim()
public static String valueOf(boolean b)
public static String valueOf(char c)
public static String valueOf(char[] c)
public static String valueOf(char[] c, int start, int length)
public static String valueOf(double d)
public static String valueOf(float f)
public static String valueOf(int i)
public static String valueOf(long i)
public static String valueOf(Object aObj)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |