Constructor Summary |
|
String() Constructs an empty string |
|
String(String value) Constructs a copy of value |
|
String(StringBuilder builder) Constructs a copy using the content of builder |
|
String(char[] value) Constructs a copy of value |
|
String(char[] value, int offset, int count) Constructs a copy of value, starting from offset, using count characters |
Method Summary |
|
| char |
charAt(int index) Returns the character at index |
| String |
concat(String str) Returns a new string from concatening this and str |
| bool |
endsWith(String postfix) Returns true if the string ends with postfix |
| bool |
equals(Object obj) Returns true if obj is a string with the same content as this |
| int | hashCode() |
| int |
indexOf(char ch, int fromIndex) Returns the index of the first occurance of a character starting from an index |
| int |
indexOf(String str, int fromIndex) Returns the index of the first occurance of a string starting from an index |
| int |
length() Returns the number of characters in this string |
| bool |
startsWith(String prefix) Returns true if the string starts with a prefix |
| bool |
startsWith(String prefix, int offset) Returns true if the string contains a prefix at the specified index |
| String |
substring(int beginIndex) Returns a sub string starting from at beginIndex |
| String |
substring(int beginIndex, int endIndex) Returns a sub string (beginIndex...endIndex-1) |
| char[] |
toCharArray() Returns a copy of this string as a char array |
| String |
toString() Trivial implementation of toString(), returns this |
| static String |
valueOf(char c) Returns a string representation of c |
| static String |
valueOf(double d) Returns a string representation of d (decimal) |
| static String |
valueOf(float f) Returns a string representation of f (decimal) |
| static String |
valueOf(int n) Returns a string representation of n (decimal) |
| static String |
valueOf(long l) Returns a string representation of l (decimal) |
| static String |
valueOf(bool b) Returns a string representation of b |
Constructor Detail |
public String()
Constructs an empty string
public String(String value)
Constructs a copy of value
public String(StringBuilder builder)
Constructs a copy using the content of builder
public String(char[] value)
Constructs a copy of value
public String(char[] value, int offset, int count)
Constructs a copy of value, starting from offset, using count characters
Method Detail |
public char charAt(int index)
Returns the character at index
index: 0..length()-1
public String concat(String str)
Returns a new string from concatening this and str
public bool endsWith(String postfix)
Returns true if the string ends with postfix
public bool equals(Object obj)
Returns true if obj is a string with the same content as this
public int hashCode()
public int indexOf(char ch, int fromIndex)
Returns the index of the first occurance of a character starting from an index
Parameters:
| ch | - | the character to look for | |
| fromIndex | - | the starting index |
Returns:
the index of the first occurrence, or -1 of not found
Since:
2.6.5.6
public int indexOf(String str, int fromIndex)
Returns the index of the first occurance of a string starting from an index
Parameters:
| str | - | the string to look for | |
| fromIndex | - | the starting index |
Returns:
the index of the first occurrence, or -1 of not found
Since:
2.6.5.6
public int length()
Returns the number of characters in this string
public bool startsWith(String prefix)
Returns true if the string starts with a prefix
Parameters:
| prefix | - | the prefix |
public bool startsWith(String prefix, int offset)
Returns true if the string contains a prefix at the specified index
Parameters:
| offset | - | the index in this string where to look for the prefix | |
| prefix | - | the prefix |
Since:
2.6.5.6
public String substring(int beginIndex)
Returns a sub string starting from at beginIndex
public String substring(int beginIndex, int endIndex)
Returns a sub string (beginIndex...endIndex-1)
public char[] toCharArray()
Returns a copy of this string as a char array
public String toString()
Trivial implementation of toString(), returns this
public static String valueOf(char c)
Returns a string representation of c
public static String valueOf(double d)
Returns a string representation of d (decimal)
public static String valueOf(float f)
Returns a string representation of f (decimal)
public static String valueOf(int n)
Returns a string representation of n (decimal)
public static String valueOf(long l)
Returns a string representation of l (decimal)
public static String valueOf(bool b)
Returns a string representation of b