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 Stringappend(char c)Stringappend(double d)Stringappend(java.lang.Object... obj)voidclear()Point<java.lang.Integer>getBounds(Font f)java.lang.StringBuildergetBuilder()intindexOf(java.lang.String str)Returns the index within this string of the first occurrence of the specified substring.intindexOf(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.intlength()Stringreplace(int start, int end, java.lang.String str)Replaces the characters in a substring of this sequence with characters in the specifiedString.Stringsubstring(int start)Returns a newStringthat contains a subsequence of characters currently contained in this character sequence.Stringsubstring(int start, int end)Returns a newStringthat contains a subsequence of characters currently contained in this sequence.java.lang.StringtoString()
-
-
-
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
kfor which:
If no such value ofthis.toString().startsWith(str, k)kexists, then-1is returned.- Parameters:
str- the substring to search for.- Returns:
- the index of the first occurrence of the specified substring,
or
-1if 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
kfor which:
If no such value ofk >= Math.min(fromIndex, this.length()) && this.toString().startsWith(str, k)kexists, then-1is 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
-1if 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 specifiedstartand extends to the character at indexend - 1or to the end of the sequence if no such character exists. First the characters in the substring are removed and then the specifiedStringis 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- ifstartis negative, greater thanlength(), or greater thanend.
-
substring
public String substring(int start)
Returns a newStringthat 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- ifstartis less than zero, or greater than the length of this object.
-
substring
public String substring(int start, int end)
Returns a newStringthat contains a subsequence of characters currently contained in this sequence. The substring begins at the specifiedstartand 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- ifstartorendare negative or greater thanlength(), orstartis greater thanend.
-
length
public int length()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-