Package net.fauxpark.stringes
Class Stringe
- java.lang.Object
-
- net.fauxpark.stringes.Stringe
-
- All Implemented Interfaces:
CharSequence
,Iterable<Chare>
- Direct Known Subclasses:
Token
public class Stringe extends Object implements CharSequence, Iterable<Chare>
Represents a string or a substring in relation to its parent. Provides line number, column, offset and other useful data.
-
-
Method Summary
Modifier and Type Method Description static Stringe
between(Stringe a, Stringe b)
Returns a Stringe comprised of all text between the two specified Stringes.char
charAt(int index)
Returns the char value at the specified index.Chare
chareAt(int index)
Returns the Chare at the specified index.Stringe
dilate(int left, int right)
Returns a new substringe whose left and right boundaries are offset by the specified values.static Stringe
empty(Stringe basis)
Returns an empty Stringe based on the position of another Stringe.boolean
endsWith(String suffix)
Tests if the string value of this Stringe ends with the specified suffix.boolean
equals(Object obj)
Determines whether the current Stringe is equal to the specified object.boolean
equalsIgnoreCase(String str)
Compares the string value of this Stringe to another string, ignoring case considerations.boolean
equalsIgnoreCase(Stringe stre)
Compares the string value of this Stringe to the string value of another Stringe, ignoring case considerations.int
getColumn()
Returns the 1-based column number at which the Stringe begins.int
getEnd()
Returns the index at which the Stringe ends in the string.int
getLine()
Returns the 1-based line number at which the Stringe begins.int
getNextIndex()
Returns the next index in the parent string at which the current Stringe value occurs.int
getOccurrenceCount()
Returns the number of times the current Stringe occurs in the parent string.String
getParent()
Returns the original string from which the Stringe was originally derived.String
getValue()
Returns the substring value represented by the Stringe.int
hashCode()
Returns the hash code of the current Stringe.int
indexOf(char c)
Returns the zero-based index at which the specified character first occurs, relative to the substringe.int
indexOf(char c, int startIndex)
Returns the zero-based index at which the specified character first occurs, relative to the substringe.int
indexOf(String str)
Returns the zero-based index at which the specified string first occurs, relative to the substringe.int
indexOf(String str, int startIndex)
Returns the zero-based index at which the specified string first occurs, relative to the substringe.int
indexOfIgnoreCase(char c, int startIndex)
Returns the zero-based index at which the specified character first occurs, relative to the substringe.int
indexOfIgnoreCase(String str, int startIndex)
Returns the zero-based index at which the specified string first occurs, relative to the substringe.int
indexOfTotal(char c)
Returns the zero-based index at which the specified character first occurs, relative to the parent.int
indexOfTotal(char c, int startIndex)
Returns the zero-based index at which the specified character first occurs, relative to the parent.int
indexOfTotal(String str)
Returns the zero-based index at which the specified string first occurs, relative to the parent.int
indexOfTotal(String str, int startIndex)
Returns the zero-based index at which the specified string first occurs, relative to the parent.int
indexOfTotalIgnoreCase(char c, int startIndex)
Returns the zero-based index at which the specified character first occurs, relative to the parent.int
indexOfTotalIgnoreCase(String str, int startIndex)
Returns the zero-based index at which the specified string first occurs, relative to the parent.boolean
isEmpty()
Returns true if, and only if, length() is 0.boolean
isLeftPadded()
Determines whether the Stringe is left padded.static boolean
isNullOrEmpty(Stringe stre)
Indicates whether the specified Stringe is null or empty.boolean
isRightPadded()
Determines whether the Stringe is right padded.boolean
isSubstring()
Indicates if the Stringe is a substring.boolean
isSubstringeOf(Stringe parent)
Determines whether the current Stringe is a substringe of the specified parent Stringe.Iterator<Chare>
iterator()
Returns an iterator that iterates through the Chares in the Stringe.int
lastIndexOf(char c)
Returns the zero-based index at which the specified character last occurs, relative to the substringe.int
lastIndexOf(char c, int endIndex)
Returns the zero-based index at which the specified character last occurs, relative to the substringe.int
lastIndexOf(String str)
Returns the zero-based index at which the specified string last occurs, relative to the substringe.int
lastIndexOf(String str, int endIndex)
Returns the zero-based index at which the specified string last occurs, relative to the substringe.int
lastIndexOfIgnoreCase(char c, int endIndex)
Returns the zero-based index at which the specified character last occurs, relative to the substringe.int
lastIndexOfIgnoreCase(String str, int endIndex)
Returns the zero-based index at which the specified string last occurs, relative to the substringe.int
lastIndexOfTotal(char c)
Returns the zero-based index at which the specified character last occurs, relative to the parent.int
lastIndexOfTotal(char c, int endIndex)
Returns the zero-based index at which the specified character last occurs, relative to the parent.int
lastIndexOfTotal(String str)
Returns the zero-based index at which the specified string last occurs, relative to the parent.int
lastIndexOfTotal(String str, int endIndex)
Returns the zero-based index at which the specified string last occurs, relative to the parent.int
lastIndexOfTotalIgnoreCase(char c, int endIndex)
Returns the zero-based index at which the specified character last occurs, relative to the parent.int
lastIndexOfTotalIgnoreCase(String str, int endIndex)
Returns the zero-based index at which the specified string last occurs, relative to the parent.int
length()
Returns the length of the string.(package private) void
mutate(Stringe stre)
Mutates the Stringe into another Stringe.int
offset()
Returns the offset of the Stringe.static Stringe
range(Stringe a, Stringe b)
Returns a Stringe comprised of all text between and including the two specified Stringes.Stringe
slice(int left, int right)
Returns a substringe that contains all characters between the two specified positions in the Stringe.List<Stringe>
split(char... separators)
Splits the Stringe into multiple parts by the specified delimiters.List<Stringe>
split(char[] separators, boolean keepEmpty)
Splits the Stringe into multiple parts by the specified delimiters.List<Stringe>
split(char[] separators, int count, boolean keepEmpty)
Splits the Stringe into multiple parts by the specified delimiters.List<Stringe>
split(String... separators)
Splits the Stringe into multiple parts by the specified delimiters.List<Stringe>
split(String[] separators, boolean keepEmpty)
Splits the Stringe into multiple parts by the specified delimiters.List<Stringe>
split(String[] separators, int count, boolean keepEmpty)
Splits the Stringe into multiple parts by the specified delimiters.boolean
startsWith(String prefix)
Tests if this Stringe's value starts with the specified prefix.boolean
startsWith(String prefix, int toffset)
Tests if the substring of this Stringe's value beginning at the specified index starts with the specified prefix.Stringe
subSequence(int startIndex, int endIndex)
Returns a Stringe that is a subsequence of this sequence.Stringe
substringe(int offset)
Creates a substringe from the Stringe, starting at the specified index and extending to the end.Stringe
substringe(int offset, int length)
Creates a substringe from the Stringe, starting at the specified index and extending for the specified length.Stringe
toLowerCase()
Returns a copy of this Stringe with all of its characters converted to lower case.String
toString()
Returns the string value of the Stringe.static Stringe
toStringe(Object obj)
Converts the specified object into a Stringe.Stringe
toUpperCase()
Returns a copy of this Stringe with all of its characters converted to upper case.Stringe
trim()
Returns the Stringe with any leading and trailing white space removed.Stringe
trim(char... trimChars)
Returns the Stringe with any leading and trailing occurrences of the specified characters removed.Stringe
trimEnd(char... trimChars)
Returns the Stringe with any trailing occurrences of the specified characters removed.Stringe
trimStart(char... trimChars)
Returns the Stringe with any leading occurrences of the specified characters removed.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.CharSequence
chars, codePoints
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
Stringe
public Stringe(String str) throws IllegalArgumentException
Constructs a new Stringe from the specified string.- Parameters:
str
- The string to turn into a Stringe.- Throws:
IllegalArgumentException
- If the input string is null.
-
Stringe
Stringe(Stringe stre)
Constructs a new Stringe from another Stringe.- Parameters:
stre
- The Stringe to clone.
-
-
Method Detail
-
mutate
void mutate(Stringe stre)
Mutates the Stringe into another Stringe.- Parameters:
stre
- The Stringe to mutate into.
-
toStringe
public static Stringe toStringe(Object obj)
Converts the specified object into a Stringe.- Parameters:
obj
- The object to convert.- Returns:
- The given object as a Stringe.
-
empty
public static Stringe empty(Stringe basis)
Returns an empty Stringe based on the position of another Stringe.- Parameters:
basis
- The basis Stringe to get position info from.- Returns:
- An empty Stringe.
-
isNullOrEmpty
public static boolean isNullOrEmpty(Stringe stre)
Indicates whether the specified Stringe is null or empty.- Parameters:
stre
- The Stringe to test.- Returns:
- True if the Stringe is null or has a length of 0.
-
range
public static Stringe range(Stringe a, Stringe b) throws IllegalArgumentException
Returns a Stringe comprised of all text between and including the two specified Stringes. The Stringes must both belong to the same parent string.- Parameters:
a
- The first Stringe.b
- The second Stringe.- Returns:
- The Stringe between and including the two given Stringes.
- Throws:
IllegalArgumentException
- If either of the arguments are null, or if the Stringes do not belong to the same parent.
-
between
public static Stringe between(Stringe a, Stringe b) throws IllegalArgumentException
Returns a Stringe comprised of all text between the two specified Stringes.- Parameters:
a
- The first Stringe.b
- The second Stringe.- Returns:
- The Stringe between the two given Stringes, or null if they intersect or are adjacent.
- Throws:
IllegalArgumentException
- If either of the arguments are null, or the Stringes do not belong to the same parent.
-
offset
public int offset()
Returns the offset of the Stringe.- Returns:
- The offset of this Stringe in the string.
-
length
public int length()
Returns the length of the string.- Specified by:
length
in interfaceCharSequence
- Returns:
- The length of the string represented by the Stringe.
-
getLine
public int getLine()
Returns the 1-based line number at which the Stringe begins.- Returns:
- The line number this Stringe is on.
-
getColumn
public int getColumn()
Returns the 1-based column number at which the Stringe begins.- Returns:
- The column number this Stringe begins at.
-
getEnd
public int getEnd()
Returns the index at which the Stringe ends in the string.- Returns:
- The column number this Stringe ends at.
-
getValue
public String getValue()
Returns the substring value represented by the Stringe. If the Stringe is the parent, this will provide the original string.- Returns:
- The underlying string value of the Stringe.
-
getParent
public String getParent()
Returns the original string from which the Stringe was originally derived.- Returns:
- The parent string of the Stringe.
-
getOccurrenceCount
public int getOccurrenceCount()
Returns the number of times the current Stringe occurs in the parent string.- Returns:
- The number of occurrences of the Stringe in the parent string.
-
getNextIndex
public int getNextIndex()
Returns the next index in the parent string at which the current Stringe value occurs.- Returns:
- The index of the next occurrence of the String in the parent String.
-
isSubstring
public boolean isSubstring()
Indicates if the Stringe is a substring.- Returns:
- True if the Stringe is a substring of the parent string.
-
isEmpty
public boolean isEmpty()
Returns true if, and only if, length() is 0.- Returns:
- True if the length of the string is 0.
-
isSubstringeOf
public boolean isSubstringeOf(Stringe parent)
Determines whether the current Stringe is a substringe of the specified parent Stringe.- Parameters:
parent
- the parent Stringe to compare to.- Returns:
- True if the Stringe is a substringe of the given Stringe.
-
indexOf
public int indexOf(String str)
Returns the zero-based index at which the specified string first occurs, relative to the substringe.- Parameters:
str
- The string to search for.- Returns:
- The index of the first occurrence of the given string in the Stringe, or -1 if it was not found.
-
indexOf
public int indexOf(String str, int startIndex)
Returns the zero-based index at which the specified string first occurs, relative to the substringe. The search starts at the specified index.- Parameters:
str
- The string to search for.startIndex
- The index at which to begin the search.- Returns:
- The index of the first occurrence of the given string in the Stringe, starting from the given index, or -1 if it was not found.
-
indexOfIgnoreCase
public int indexOfIgnoreCase(String str, int startIndex)
Returns the zero-based index at which the specified string first occurs, relative to the substringe.- Parameters:
str
- The string to search for.startIndex
- The index at which to begin the search.- Returns:
- The index of the first occurrence of the given string in the Stringe, starting from the given index, or -1 if it was not found.
-
indexOfTotal
public int indexOfTotal(String str)
Returns the zero-based index at which the specified string first occurs, relative to the parent.- Parameters:
str
- The string to search for.- Returns:
- The index of the first occurrence of the given string in the Stringe's parent string, or -1 if it was not found.
-
indexOfTotal
public int indexOfTotal(String str, int startIndex)
Returns the zero-based index at which the specified string first occurs, relative to the parent. The search starts at the specified index.- Parameters:
str
- The string to search for.startIndex
- The index at which to begin the search.- Returns:
- The index of the first occurrence of the given string in the Stringe's parent string, starting from the given index, or -1 if it was not found.
-
indexOfTotalIgnoreCase
public int indexOfTotalIgnoreCase(String str, int startIndex)
Returns the zero-based index at which the specified string first occurs, relative to the parent.- Parameters:
str
- The string to search for.startIndex
- The index at which to begin the search.- Returns:
- The index of the first occurrence of the given string in the Stringe's parent string, starting from the given index, or -1 if it was not found.
-
indexOf
public int indexOf(char c)
Returns the zero-based index at which the specified character first occurs, relative to the substringe.- Parameters:
c
- The character to search for.- Returns:
- The index of the first occurrence of the given char in the Stringe, or -1 if it was not found.
-
indexOf
public int indexOf(char c, int startIndex)
Returns the zero-based index at which the specified character first occurs, relative to the substringe. The search starts at the specified index.- Parameters:
c
- The character to search for.startIndex
- The index at which to begin the search.- Returns:
- The index of the first occurrence of the given char in the Stringe, starting from the given index, or -1 if it was not found.
-
indexOfIgnoreCase
public int indexOfIgnoreCase(char c, int startIndex)
Returns the zero-based index at which the specified character first occurs, relative to the substringe.- Parameters:
c
- The character to search for.startIndex
- The index at which to begin the search.- Returns:
- The index of the first occurrence of the given char in the Stringe, starting from the given index, or -1 if it was not found.
-
indexOfTotal
public int indexOfTotal(char c)
Returns the zero-based index at which the specified character first occurs, relative to the parent.- Parameters:
c
- The character to search for.- Returns:
- The index of the first occurrence of the given char in the Stringe's parent string, or -1 if it was not found.
-
indexOfTotal
public int indexOfTotal(char c, int startIndex)
Returns the zero-based index at which the specified character first occurs, relative to the parent. The search starts at the specified index.- Parameters:
c
- The character to search for.startIndex
- The index at which to begin the search.- Returns:
- The index of the first occurrence of the given char in the Stringe's parent string, starting from the given index, or -1 if it was not found.
-
indexOfTotalIgnoreCase
public int indexOfTotalIgnoreCase(char c, int startIndex)
Returns the zero-based index at which the specified character first occurs, relative to the parent.- Parameters:
c
- The character to search for.startIndex
- The index at which to begin the search.- Returns:
- The index of the first occurrence of the given char in the Stringe's parent string, starting from the given index, or -1 if it was not found.
-
lastIndexOf
public int lastIndexOf(String str)
Returns the zero-based index at which the specified string last occurs, relative to the substringe. The search starts at the specified index, and moves backwards.- Parameters:
str
- The string to search for.- Returns:
- The index of the last occurrence of the given string in the Stringe, or -1 if it was not found.
-
lastIndexOf
public int lastIndexOf(String str, int endIndex)
Returns the zero-based index at which the specified string last occurs, relative to the substringe. The search starts at the specified index, and moves backwards.- Parameters:
str
- The string to search for.endIndex
- The index at which to begin the search.- Returns:
- The index of the last occurrence of the given string in the Stringe, ending at the given index, or -1 if it was not found.
-
lastIndexOfIgnoreCase
public int lastIndexOfIgnoreCase(String str, int endIndex)
Returns the zero-based index at which the specified string last occurs, relative to the substringe. The search starts at the specified index, and moves backwards.- Parameters:
str
- The string to search for.endIndex
- The index at which to begin the search.- Returns:
- The index of the last occurrence of the given string in the Stringe, ending at the given index, or -1 if it was not found.
-
lastIndexOfTotal
public int lastIndexOfTotal(String str)
Returns the zero-based index at which the specified string last occurs, relative to the parent. The search starts at the specified index, and moves backwards.- Parameters:
str
- The string to search for.- Returns:
- The index of the last occurrence of the given string in the Stringe's parent string, or -1 if it was not found.
-
lastIndexOfTotal
public int lastIndexOfTotal(String str, int endIndex)
Returns the zero-based index at which the specified string last occurs, relative to the parent. The search starts at the specified index, and moves backwards.- Parameters:
str
- The string to search for.endIndex
- The index at which to begin the search.- Returns:
- The index of the last occurrence of the given string in the Stringe's parent string, ending at the given index, or -1 if it was not found.
-
lastIndexOfTotalIgnoreCase
public int lastIndexOfTotalIgnoreCase(String str, int endIndex)
Returns the zero-based index at which the specified string last occurs, relative to the parent. The search starts at the specified index, and moves backwards.- Parameters:
str
- The string to search for.endIndex
- The index at which to begin the search.- Returns:
- The index of the last occurrence of the given string in the Stringe's parent string, ending at the given index, or -1 if it was not found.
-
lastIndexOf
public int lastIndexOf(char c)
Returns the zero-based index at which the specified character last occurs, relative to the substringe.- Parameters:
c
- The character to search for.- Returns:
- The index of the last occurrence of the given char in the Stringe, or -1 if it was not found.
-
lastIndexOf
public int lastIndexOf(char c, int endIndex)
Returns the zero-based index at which the specified character last occurs, relative to the substringe. The search starts at the specified index, and moves backwards.- Parameters:
c
- The character to search for.endIndex
- The index at which to begin the search.- Returns:
- The index of the last occurrence of the given char in the Stringe, ending at the given index, or -1 if it was not found.
-
lastIndexOfIgnoreCase
public int lastIndexOfIgnoreCase(char c, int endIndex)
Returns the zero-based index at which the specified character last occurs, relative to the substringe. The search starts at the specified index, and moves backwards.- Parameters:
c
- The character to search for.endIndex
- The index at which to begin the search.- Returns:
- The index of the last occurrence of the given char in the Stringe, ending at the given index, or -1 if it was not found.
-
lastIndexOfTotal
public int lastIndexOfTotal(char c)
Returns the zero-based index at which the specified character last occurs, relative to the parent.- Parameters:
c
- The character to search for.- Returns:
- The index of the last occurrence of the given char in the Stringe's parent string, or -1 if it was not found.
-
lastIndexOfTotal
public int lastIndexOfTotal(char c, int endIndex)
Returns the zero-based index at which the specified character last occurs, relative to the parent. The search starts at the specified index, and moves backwards.- Parameters:
c
- The character to search for.endIndex
- The index at which to begin the search.- Returns:
- The index of the last occurrence of the given char in the Stringe's parent string, ending at the given index, or -1 if it was not found.
-
lastIndexOfTotalIgnoreCase
public int lastIndexOfTotalIgnoreCase(char c, int endIndex)
Returns the zero-based index at which the specified character last occurs, relative to the parent. The search starts at the specified index, and moves backwards.- Parameters:
c
- The character to search for.endIndex
- The index at which to begin the search.- Returns:
- The index of the last occurrence of the given char in the Stringe's parent string, or -1 if it was not found.
-
substringe
public Stringe substringe(int offset, int length)
Creates a substringe from the Stringe, starting at the specified index and extending for the specified length.- Parameters:
offset
- The offset at which to begin the substringe.length
- The length of the substringe.- Returns:
- A substringe of this Stringe.
-
substringe
public Stringe substringe(int offset)
Creates a substringe from the Stringe, starting at the specified index and extending to the end.- Parameters:
offset
- The offset at which to begin the substringe.- Returns:
- A substringe of this Stringe.
-
subSequence
public Stringe subSequence(int startIndex, int endIndex) throws StringIndexOutOfBoundsException
Returns a Stringe that is a subsequence of this sequence.- Specified by:
subSequence
in interfaceCharSequence
- Parameters:
startIndex
- The index to start the subsequence from.endIndex
- The index to end the subsequence at.- Returns:
- A substringe of this Stringe.
- Throws:
StringIndexOutOfBoundsException
- If start or end are negative, if end is greater than length(), or if start is greater than end.
-
slice
public Stringe slice(int left, int right) throws IllegalArgumentException, StringIndexOutOfBoundsException
Returns a substringe that contains all characters between the two specified positions in the Stringe.- Parameters:
left
- The left side of the slice.right
- The right side of the slice.- Returns:
- A substringe of this Stringe.
- Throws:
IllegalArgumentException
- If the right side of the slice is less than the left side.StringIndexOutOfBoundsException
- If either of the arguments are negative, or greater than the length of the Stringe.
-
dilate
public Stringe dilate(int left, int right) throws StringIndexOutOfBoundsException
Returns a new substringe whose left and right boundaries are offset by the specified values.- Parameters:
left
- The amount, in characters, to offset the left boundary to the left.right
- The amount, in characters, to offset the right boundary to the right.- Returns:
- a superstringe of this Stringe.
- Throws:
StringIndexOutOfBoundsException
- If the new length is negative or the Stringe is expanded beyond the ends of the string.
-
trim
public Stringe trim()
Returns the Stringe with any leading and trailing white space removed.- Returns:
- The Stringe with leading and trailing whitespace characters trimmed.
-
trim
public Stringe trim(char... trimChars)
Returns the Stringe with any leading and trailing occurrences of the specified characters removed.- Parameters:
trimChars
- The characters to remove.- Returns:
- The Stringe with the given leading and trailing characters trimmed.
-
trimStart
public Stringe trimStart(char... trimChars)
Returns the Stringe with any leading occurrences of the specified characters removed.- Parameters:
trimChars
- The characters to remove.- Returns:
- The Stringe with the given leading characters trimmed.
-
trimEnd
public Stringe trimEnd(char... trimChars)
Returns the Stringe with any trailing occurrences of the specified characters removed.- Parameters:
trimChars
- The characters to remove.- Returns:
- The Stringe with the given trailing characters trimmed.
-
isLeftPadded
public boolean isLeftPadded()
Determines whether the Stringe is left padded.- Returns:
- True if the left side of the line on which the Stringe exists is composed entirely of white space.
-
isRightPadded
public boolean isRightPadded()
Determines whether the Stringe is right padded.- Returns:
- True if the right side of the line on which the Stringe exists is composed entirely of white space.
-
split
public List<Stringe> split(char... separators)
Splits the Stringe into multiple parts by the specified delimiters.- Parameters:
separators
- The delimiters by which to split the Stringe.- Returns:
- A list of Stringes split by the given delimiter characters.
-
split
public List<Stringe> split(String... separators)
Splits the Stringe into multiple parts by the specified delimiters.- Parameters:
separators
- The delimiters by which to split the Stringe.- Returns:
- A list of Stringes split by the given delimiter strings.
-
split
public List<Stringe> split(char[] separators, boolean keepEmpty)
Splits the Stringe into multiple parts by the specified delimiters.- Parameters:
separators
- The delimiters by which to split the Stringe.keepEmpty
- Specifies whether empty substringes should be included in the return value.- Returns:
- A list of Stringes split by the given delimiter characters.
-
split
public List<Stringe> split(String[] separators, boolean keepEmpty)
Splits the Stringe into multiple parts by the specified delimiters.- Parameters:
separators
- The delimiters by which to split the Stringe.keepEmpty
- Specifies whether empty substringes should be included in the return value.- Returns:
- A list of Stringes split by the given delimiter strings.
-
split
public List<Stringe> split(char[] separators, int count, boolean keepEmpty)
Splits the Stringe into multiple parts by the specified delimiters.- Parameters:
separators
- The delimiters by which to split the Stringe.count
- The maximum number of substringes to return. If the count exceeds this number, the last item will be the remainder of the Stringe.keepEmpty
- Specifies whether empty substringes should be included in the return value.- Returns:
- A list of Stringes split by the given delimiter characters.
-
split
public List<Stringe> split(String[] separators, int count, boolean keepEmpty)
Splits the Stringe into multiple parts by the specified delimiters.- Parameters:
separators
- The delimiters by which to split the Stringe.count
- The maximum number of substringes to return. If the count exceeds this number, the last item will be the remainder of the Stringe.keepEmpty
- Specifies whether empty substringes should be included in the return value.- Returns:
- A list of Stringes split by the given delimiter strings.
-
startsWith
public boolean startsWith(String prefix)
Tests if this Stringe's value starts with the specified prefix.- Parameters:
prefix
- The prefix.- Returns:
- True if the Stringe begins with the given string.
-
startsWith
public boolean startsWith(String prefix, int toffset)
Tests if the substring of this Stringe's value beginning at the specified index starts with the specified prefix.- Parameters:
prefix
- The prefix.toffset
- Where to begin looking in the string.- Returns:
- True if the Stringe begins with the given string at the given offset.
-
endsWith
public boolean endsWith(String suffix)
Tests if the string value of this Stringe ends with the specified suffix.- Parameters:
suffix
- The suffix.- Returns:
- True if the Stringe ends with the given string.
-
toLowerCase
public Stringe toLowerCase()
Returns a copy of this Stringe with all of its characters converted to lower case.- Returns:
- The Stringe converted to lower case.
-
toUpperCase
public Stringe toUpperCase()
Returns a copy of this Stringe with all of its characters converted to upper case.- Returns:
- The Stringe converted to upper case.
-
charAt
public char charAt(int index) throws StringIndexOutOfBoundsException
Returns the char value at the specified index.- Specified by:
charAt
in interfaceCharSequence
- Parameters:
index
- The index of the char value.- Returns:
- The character at the given index within the Stringe.
- Throws:
StringIndexOutOfBoundsException
- If the index is negative or not less than the length of this Stringe.
-
chareAt
public Chare chareAt(int index) throws StringIndexOutOfBoundsException
Returns the Chare at the specified index.- Parameters:
index
- The index of the Chare.- Returns:
- The Chare at the given index within the Stringe.
- Throws:
StringIndexOutOfBoundsException
- If the index is negative or not less than the length of this Stringe.
-
equals
public boolean equals(Object obj)
Determines whether the current Stringe is equal to the specified object.
-
equalsIgnoreCase
public boolean equalsIgnoreCase(String str)
Compares the string value of this Stringe to another string, ignoring case considerations.- Parameters:
str
- The string to compare this Stringe against.- Returns:
- True if the given string is equal to this Stringe's value, ignoring case considerations.
-
equalsIgnoreCase
public boolean equalsIgnoreCase(Stringe stre)
Compares the string value of this Stringe to the string value of another Stringe, ignoring case considerations.- Parameters:
stre
- The Stringe to compare this Stringe against.- Returns:
- True if the given Stringe's value is equal to this Stringe's value, ignoring case considerations.
-
hashCode
public int hashCode()
Returns the hash code of the current Stringe.
-
toString
public String toString()
Returns the string value of the Stringe.- Specified by:
toString
in interfaceCharSequence
- Overrides:
toString
in classObject
- Returns:
- The string value of the Stringe.
-
-