String

public class String extends Object
implements CharSequence Comparable<String> Serializable

Stub implementation of java.lang.String.

See Also

Field Summary

public static final Comparator<String> CASE_INSENSITIVE_ORDER

Public Constructor Summary

String()
String(byte[] bytes)
String(byte[] bytes, int hibyte)
String(byte[] bytes, int offset, int count)
String(byte[] bytes, int hibyte, int offset, int count)
String(byte[] bytes, int i, int j, String s)
String(byte[] bytes, int offset, int length, Charset charset)
String(byte[] bytes, Charset cs)
String(byte[] bytes, String s)
String(char[] chars)
String(char[] chars, int i, int j)
String(int[] codePoints, int offset, int length)

Public Method Summary

char
charAt(int i)
Returns the char value at the specified index.
int
codePointAt(int i)
int
int
codePointCount(int i, int j)
int
int
String
boolean
boolean
boolean
static String
copyValueOf(char[] chars, int i, int j)
static String
copyValueOf(char[] chars)
boolean
boolean
static String
static String
byte[]
byte[]
byte[]
void
getBytes(int srcBegin, int srcEnd, byte[] dst, int dstBegin)
void
getChars(int i, int j, char[] chars, int k)
int
indexOf(int i, int j)
int
int
indexOf(int i)
int
indexOf(String s, int i)
String
intern()
boolean
static String
join(CharSequence delimiter, CharSequence... elements)
static String
join(CharSequence delimiter, Iterable<? extends CharSequence> elements)
int
lastIndexOf(int i)
int
lastIndexOf(String s, int i)
int
int
lastIndexOf(int i, int j)
int
length()
Returns the length of this character sequence.
boolean
int
offsetByCodePoints(int index, int codePointOffset)
boolean
regionMatches(boolean b, int i, String s, int j, int k)
boolean
regionMatches(int i, String s, int j, int k)
String
String
replace(char c1, char c2)
String
String
String[]
String[]
split(String s, int i)
boolean
boolean
startsWith(String s, int i)
CharSequence
subSequence(int i, int j)
Returns a new CharSequence that is a subsequence of this sequence.
String
substring(int i, int j)
String
substring(int i)
char[]
String
String
String
String
String
trim()
static String
valueOf(boolean b)
static String
valueOf(double d)
static String
valueOf(char[] chars, int i, int j)
static String
valueOf(float f)
static String
valueOf(int i)
static String
valueOf(char c)
static String
valueOf(long l)
static String
static String
valueOf(char[] chars)

Inherited Method Summary

Fields

public static final Comparator<String> CASE_INSENSITIVE_ORDER

Public Constructors

public String ()

public String (byte[] bytes)

Parameters
bytes

public String (byte[] bytes, int hibyte)

Parameters
bytes
hibyte

public String (byte[] bytes, int offset, int count)

Parameters
bytes
offset
count

public String (byte[] bytes, int hibyte, int offset, int count)

Parameters
bytes
hibyte
offset
count

public String (byte[] bytes, int i, int j, String s)

Parameters
bytes
i
j
s

public String (byte[] bytes, int offset, int length, Charset charset)

Parameters
bytes
offset
length
charset

public String (byte[] bytes, Charset cs)

Parameters
bytes
cs

public String (byte[] bytes, String s)

Parameters
bytes
s

public String (char[] chars)

Parameters
chars

public String (char[] chars, int i, int j)

Parameters
chars
i
j

public String (int[] codePoints, int offset, int length)

Parameters
codePoints
offset
length

public String (String s)

Parameters
s

public String (StringBuffer sb)

Parameters
sb

public String (StringBuilder sb)

Parameters
sb

Public Methods

public char charAt (int i)

Returns the char value at the specified index. An index ranges from zero to length() - 1. The first char value of the sequence is at index zero, the next at index one, and so on, as for array indexing.

If the char value specified by the index is a surrogate, the surrogate value is returned.

Parameters
i the index of the char value to be returned
Returns
  • the specified char value

public int codePointAt (int i)

Parameters
i

public int codePointBefore (int i)

Parameters
i

public int codePointCount (int i, int j)

Parameters
i
j

public int compareTo (String s)

Parameters
s

public int compareToIgnoreCase (String s)

Parameters
s

public String concat (String s)

Parameters
s

public boolean contains (CharSequence cs)

Parameters
cs

public boolean contentEquals (StringBuffer sb)

Parameters
sb

public boolean contentEquals (CharSequence cs)

Parameters
cs

public static String copyValueOf (char[] chars, int i, int j)

Parameters
chars
i
j

public static String copyValueOf (char[] chars)

Parameters
chars

public boolean endsWith (String s)

Parameters
s

public boolean equalsIgnoreCase (String s)

Parameters
s

public static String format (Locale l, String s, Object... objs)

Parameters
l
s
objs

public static String format (String s, Object... objs)

Parameters
s
objs

public byte[] getBytes (String s)

Parameters
s

public byte[] getBytes ()

public byte[] getBytes (Charset cs)

Parameters
cs

public void getBytes (int srcBegin, int srcEnd, byte[] dst, int dstBegin)

Parameters
srcBegin
srcEnd
dst
dstBegin

public void getChars (int i, int j, char[] chars, int k)

Parameters
i
j
chars
k

public int indexOf (int i, int j)

Parameters
i
j

public int indexOf (String s)

Parameters
s

public int indexOf (int i)

Parameters
i

public int indexOf (String s, int i)

Parameters
s
i

public String intern ()

public boolean isEmpty ()

public static String join (CharSequence delimiter, CharSequence... elements)

Parameters
delimiter
elements

public static String join (CharSequence delimiter, Iterable<? extends CharSequence> elements)

Parameters
delimiter
elements

public int lastIndexOf (int i)

Parameters
i

public int lastIndexOf (String s, int i)

Parameters
s
i

public int lastIndexOf (String s)

Parameters
s

public int lastIndexOf (int i, int j)

Parameters
i
j

public int length ()

Returns the length of this character sequence. The length is the number of 16-bit chars in the sequence.

Returns
  • the number of chars in this sequence

public boolean matches (String s)

Parameters
s

public int offsetByCodePoints (int index, int codePointOffset)

Parameters
index
codePointOffset

public boolean regionMatches (boolean b, int i, String s, int j, int k)

Parameters
b
i
s
j
k

public boolean regionMatches (int i, String s, int j, int k)

Parameters
i
s
j
k

public String replace (CharSequence cs1, CharSequence cs2)

Parameters
cs1
cs2

public String replace (char c1, char c2)

Parameters
c1
c2

public String replaceAll (String s1, String s2)

Parameters
s1
s2

public String replaceFirst (String s1, String s2)

Parameters
s1
s2

public String[] split (String s)

Parameters
s

public String[] split (String s, int i)

Parameters
s
i

public boolean startsWith (String s)

Parameters
s

public boolean startsWith (String s, int i)

Parameters
s
i

public CharSequence subSequence (int i, int j)

Returns a new CharSequence that is a subsequence of this sequence. The subsequence starts with the char value at the specified index and ends with the char value at index end - 1. The length (in chars) of the returned sequence is end - start, so if start == end then an empty sequence is returned.

Parameters
i the start index, inclusive
j the end index, exclusive
Returns
  • the specified subsequence

public String substring (int i, int j)

Parameters
i
j

public String substring (int i)

Parameters
i

public char[] toCharArray ()

public String toLowerCase ()

public String toLowerCase (Locale l)

Parameters
l

public String toUpperCase (Locale l)

Parameters
l

public String toUpperCase ()

public String trim ()

public static String valueOf (boolean b)

Parameters
b

public static String valueOf (double d)

Parameters
d

public static String valueOf (char[] chars, int i, int j)

Parameters
chars
i
j

public static String valueOf (float f)

Parameters
f

public static String valueOf (int i)

Parameters
i

public static String valueOf (char c)

Parameters
c

public static String valueOf (long l)

Parameters
l

public static String valueOf (Object o)

Parameters
o

public static String valueOf (char[] chars)

Parameters
chars