Package sig.engine
Class String
- java.lang.Object
-
- sig.engine.String
-
public class String extends java.lang.Object
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
append(char c)
String
append(double d)
String
append(java.lang.Object... obj)
void
clear()
Point<java.lang.Integer>
getBounds(Font f)
java.lang.StringBuilder
getBuilder()
int
indexOf(java.lang.String str)
Returns the index within this string of the first occurrence of the specified substring.int
indexOf(java.lang.String str, int fromIndex)
Returns the index within this string of the first occurrence of the specified substring, starting at the specified index.int
length()
String
replace(int start, int end, java.lang.String str)
Replaces the characters in a substring of this sequence with characters in the specifiedString
.String
substring(int start)
Returns a newString
that contains a subsequence of characters currently contained in this character sequence.String
substring(int start, int end)
Returns a newString
that contains a subsequence of characters currently contained in this sequence.java.lang.String
toString()
-
-
-
Method Detail
-
append
public String append(double d)
-
append
public String append(char c)
-
append
public String append(java.lang.Object... obj)
-
getBuilder
public java.lang.StringBuilder getBuilder()
-
indexOf
public int indexOf(java.lang.String str)
Returns the index within this string of the first occurrence of the specified substring.The returned index is the smallest value
k
for which:
If no such value ofthis.toString().startsWith(str, k)
k
exists, then-1
is returned.- Parameters:
str
- the substring to search for.- Returns:
- the index of the first occurrence of the specified substring,
or
-1
if there is no such occurrence.
-
clear
public void clear()
-
indexOf
public int indexOf(java.lang.String str, int fromIndex)
Returns the index within this string of the first occurrence of the specified substring, starting at the specified index.The returned index is the smallest value
k
for which:
If no such value ofk >= Math.min(fromIndex, this.length()) && this.toString().startsWith(str, k)
k
exists, then-1
is returned.- Parameters:
str
- the substring to search for.fromIndex
- the index from which to start the search.- Returns:
- the index of the first occurrence of the specified substring,
starting at the specified index,
or
-1
if there is no such occurrence.
-
replace
public String replace(int start, int end, java.lang.String str)
Replaces the characters in a substring of this sequence with characters in the specifiedString
. The substring begins at the specifiedstart
and extends to the character at indexend - 1
or to the end of the sequence if no such character exists. First the characters in the substring are removed and then the specifiedString
is inserted atstart
. (This sequence will be lengthened to accommodate the specified String if necessary.)- Parameters:
start
- The beginning index, inclusive.end
- The ending index, exclusive.str
- String that will replace previous contents.- Returns:
- This object.
- Throws:
java.lang.StringIndexOutOfBoundsException
- ifstart
is negative, greater thanlength()
, or greater thanend
.
-
substring
public String substring(int start)
Returns a newString
that contains a subsequence of characters currently contained in this character sequence. The substring begins at the specified index and extends to the end of this sequence.- Parameters:
start
- The beginning index, inclusive.- Returns:
- The new string.
- Throws:
java.lang.StringIndexOutOfBoundsException
- ifstart
is less than zero, or greater than the length of this object.
-
substring
public String substring(int start, int end)
Returns a newString
that contains a subsequence of characters currently contained in this sequence. The substring begins at the specifiedstart
and extends to the character at indexend - 1
.- Parameters:
start
- The beginning index, inclusive.end
- The ending index, exclusive.- Returns:
- The new string.
- Throws:
java.lang.StringIndexOutOfBoundsException
- ifstart
orend
are negative or greater thanlength()
, orstart
is greater thanend
.
-
length
public int length()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-