|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.lang.String
public final class String
An immutable string of characters.
Constructor Summary | |
---|---|
String(byte[] b)
Create a String from a byte array |
|
String(byte[] b,
int off,
int len)
Create a String from a byte array |
|
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. |
Method Summary | |
---|---|
char |
charAt(int index)
Return the character at the given index |
boolean |
equals(Object other)
Compares the String with an Object |
boolean |
equalsIgnoreCase(String s)
|
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 |
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 |
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()
|
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(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(char[] c)
c
- the character arraypublic String(byte[] b)
b
- the byte arraypublic String(byte[] b, int off, int len)
b
- the byte arraypublic String(byte[] b, String charset)
b
- the byte arraycharset
- ignored - assumed to be US ASCIIpublic String(byte[] b, int off, int len, String charset)
b
- the byte arraycharset
- ignored - assumed to be US ASCIIMethod Detail |
---|
public int length()
length
in interface CharSequence
public char charAt(int index)
charAt
in interface CharSequence
public void getChars(int start, int end, char[] buffer, int off)
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 int lastIndexOf(String str)
str
- the String
public int lastIndexOf(String str, int fromIndex)
str
- the StringfromIndex
- the starting point
public char[] toCharArray()
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 CharSequence subSequence(int start, int end)
subSequence
in interface CharSequence
public static String valueOf(Object aObj)
public String toString()
toString
in interface CharSequence
toString
in class Object
public boolean equals(Object other)
equals
in class Object
public boolean equalsIgnoreCase(String s)
public String toLowerCase()
public String toUpperCase()
public int hashCode()
hashCode
in class Object
public byte[] getBytes(String charset)
charset
- ignored
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)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |