Package com.globalmentor.java
Class StringBuffers
- java.lang.Object
-
- com.globalmentor.java.StringBuffers
-
@Deprecated public class StringBuffers extends java.lang.Object
Deprecated.Various methods that manipulateStringBuffer
objects. These methods are fast relative to theirStrings
counterparts, because theStringBuffer
objects on which they operate can be modified within the object instead of forcing a new object to be created. These methods furthermore modify the specifiedStringBuffer
object rather than returning a new object.- Author:
- Garret Wilson
- See Also:
Strings
-
-
Constructor Summary
Constructors Constructor Description StringBuffers()
Deprecated.
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static void
collapse(java.lang.StringBuffer stringBuffer, Characters collapseChars, java.lang.String replaceString)
Deprecated.Collapses every run of any number of collapseChars to a single replacement stringstatic int
indexOf(java.lang.StringBuffer stringBuffer, char c)
Deprecated.Returns the index of the first ocurrence of the given character in the string buffer.static int
indexOf(java.lang.StringBuffer stringBuffer, char c, int fromIndex)
Deprecated.Returns the index of the first ocurrence of the given character in the string buffer from the given index.static int
notCharIndexOf(java.lang.StringBuffer stringBuffer, java.lang.String notCharString)
Deprecated.Searches a string buffer and returns the first index of any character not in the specified string, starting from the beginning.static int
notCharIndexOf(java.lang.StringBuffer stringBuffer, java.lang.String notCharString, int fromIndex)
Deprecated.Searches a string buffer and returns the first index of any character not in the specified string, starting atfromIndex
.static java.lang.StringBuffer
removeEvery(java.lang.StringBuffer stringBuffer, char removeChar)
Deprecated.Removes every occurrence of a specified character.static java.lang.StringBuffer
removeEveryChar(java.lang.StringBuffer stringBuffer, java.lang.String removeChars)
Deprecated.Removes every occurrence of any of the given specified characters.static java.lang.StringBuffer
removeFirstCharLength(java.lang.StringBuffer stringBuffer, Characters delimiters)
Deprecated.Removes all content after and including the first occurrence of a character appearing in the delimiter string.static int
replace(java.lang.StringBuffer stringBuffer, char[] conversionTable)
Deprecated.Converts all characters in the string buffer to corresponding characters in a given lookup table.static int
replace(java.lang.StringBuffer stringBuffer, char[][] matchReplaceSetArray)
Deprecated.Replaces each matching character with a given replacement.static int
replace(java.lang.StringBuffer stringBuffer, char[] matchChars, java.lang.String[] replacementStrings)
Deprecated.Replaces each matching character with the corresponding replacement string.static int
replace(java.lang.StringBuffer stringBuffer, char matchChar, char replacementChar)
Deprecated.Replaces each matching character with the given replacement character.static int
replace(java.lang.StringBuffer stringBuffer, char matchChar, java.lang.String replacementString)
Deprecated.Replaces each matching character with the given replacement string.static java.lang.StringBuffer
replace(java.lang.StringBuffer stringBuffer, int startIndex, int endIndex, char replaceChar)
Deprecated.Removes several characters at the specified index and replaces them with the given character.static int
replace(java.lang.StringBuffer stringBuffer, java.lang.String matchChars, char replacementChar)
Deprecated.Replaces each matching character with the given replacement.static int
replace(java.lang.StringBuffer stringBuffer, java.lang.String replaceString, java.lang.String withString)
Deprecated.Replaces every occurrence of a specified string with another string.static java.lang.StringBuffer
replaceRuns(java.lang.StringBuffer stringBuffer, char matchChar, int minRunLength, int maxRunLength, char replaceChar)
Deprecated.Replaces all runs of the given character with another character.static boolean
startsWith(java.lang.StringBuffer stringBuffer, java.lang.String string)
Deprecated.Determines if the string buffer starts with the given string.static java.lang.StringBuffer
trim(java.lang.StringBuffer stringBuffer, java.lang.String delimiters)
Deprecated.Trims the specified delimiters from the beginning and end of the string buffer.static java.lang.StringBuffer
trimEnd(java.lang.StringBuffer stringBuffer, java.lang.String delimiters)
Deprecated.Trims the specified delimiters from the end of the string buffer.
-
-
-
Method Detail
-
collapse
public static void collapse(java.lang.StringBuffer stringBuffer, Characters collapseChars, java.lang.String replaceString)
Deprecated.Collapses every run of any number of collapseChars to a single replacement string- Parameters:
stringBuffer
- The buffer in which the information will be collapsed.collapseChars
- The characters to be removed from the string.replaceString
- The string which will replace the collapseChars.
-
indexOf
public static int indexOf(java.lang.StringBuffer stringBuffer, char c)
Deprecated.Returns the index of the first ocurrence of the given character in the string buffer.- Parameters:
stringBuffer
- The string buffer to search.c
- The character to look for.- Returns:
- The index in the string buffer of the given character, or -1 if no occurrence was found.
-
indexOf
public static int indexOf(java.lang.StringBuffer stringBuffer, char c, int fromIndex)
Deprecated.Returns the index of the first ocurrence of the given character in the string buffer from the given index.- Parameters:
stringBuffer
- The string buffer to search.c
- The character to look for.fromIndex
- The index at which to start the search.- Returns:
- The index in the string buffer of the given character, or -1 if no occurrence was found.
-
notCharIndexOf
public static int notCharIndexOf(java.lang.StringBuffer stringBuffer, java.lang.String notCharString)
Deprecated.Searches a string buffer and returns the first index of any character not in the specified string, starting from the beginning.- Parameters:
stringBuffer
- The string buffer to be searched.notCharString
- The string of characters to check.- Returns:
- The index of the first occurrence of one of the supplied characters, or -1 if none were found.
-
notCharIndexOf
public static int notCharIndexOf(java.lang.StringBuffer stringBuffer, java.lang.String notCharString, int fromIndex)
Deprecated.Searches a string buffer and returns the first index of any character not in the specified string, starting atfromIndex
.- Parameters:
stringBuffer
- The string buffer to be searched.notCharString
- The string of characters to check.fromIndex
- The index to search from- Returns:
- The index of the first occurrence of one of the supplied characters, or -1 if none were found.
-
removeFirstCharLength
public static java.lang.StringBuffer removeFirstCharLength(java.lang.StringBuffer stringBuffer, Characters delimiters)
Deprecated.Removes all content after and including the first occurrence of a character appearing in the delimiter string.- Parameters:
stringBuffer
- The characters to examine.delimiters
- A string of characters to search for.- Returns:
- The string buffer after removal.
-
removeEvery
public static java.lang.StringBuffer removeEvery(java.lang.StringBuffer stringBuffer, char removeChar)
Deprecated.Removes every occurrence of a specified character.- Parameters:
stringBuffer
- The string buffer from which the information will be removed.removeChar
- The character to remove from the string buffer.- Returns:
- The string buffer after removal.
-
removeEveryChar
public static java.lang.StringBuffer removeEveryChar(java.lang.StringBuffer stringBuffer, java.lang.String removeChars)
Deprecated.Removes every occurrence of any of the given specified characters.- Parameters:
stringBuffer
- The string buffer from which the information will be removed.removeChars
- The characters to be removed from the string buffer.- Returns:
- The string buffer after removal.
-
replace
public static int replace(java.lang.StringBuffer stringBuffer, char[] conversionTable)
Deprecated.Converts all characters in the string buffer to corresponding characters in a given lookup table. Any characters not in the table will remain unchanged.- Parameters:
stringBuffer
- The string buffer in which characters should be replaced.conversionTable
- A map of replacement characters each stored at the index of the matching chararacter (e.g. character code x will be replaced bycharacterTable[x]
).- Returns:
- The number of replacements made.
-
replace
public static int replace(java.lang.StringBuffer stringBuffer, char[][] matchReplaceSetArray)
Deprecated.Replaces each matching character with a given replacement.- Parameters:
stringBuffer
- The buffer in which the replacements will be made.matchReplaceSetArray
- An array of two-character arrays, each of the latter representing a set of characters, the first being a match character and the second a replacement character.- Returns:
- The number of replacements made.
-
replace
public static int replace(java.lang.StringBuffer stringBuffer, char matchChar, char replacementChar)
Deprecated.Replaces each matching character with the given replacement character.- Parameters:
stringBuffer
- The buffer in which the replacements will be made.matchChar
- The character to be replaced.replacementChar
- The character for replacing the match character.- Returns:
- The number of replacements made.
-
replace
public static int replace(java.lang.StringBuffer stringBuffer, char matchChar, java.lang.String replacementString)
Deprecated.Replaces each matching character with the given replacement string.- Parameters:
stringBuffer
- The buffer in which the replacements will be made.matchChar
- The character to be replaced.replacementString
- The string for replacing the match character.- Returns:
- The number of replacements made.
-
replace
public static int replace(java.lang.StringBuffer stringBuffer, java.lang.String matchChars, char replacementChar)
Deprecated.Replaces each matching character with the given replacement.- Parameters:
stringBuffer
- The buffer in which the replacements will be made.matchChars
- The characters, each of which will to be replaced.replacementChar
- The character for replacing the match characters.- Returns:
- The number of replacements made.
-
replace
public static int replace(java.lang.StringBuffer stringBuffer, char[] matchChars, java.lang.String[] replacementStrings)
Deprecated.Replaces each matching character with the corresponding replacement string.- Parameters:
stringBuffer
- The buffer in which the replacements will be made.matchChars
- An array of characters to be replaced.replacementStrings
- An array of strings to replace the characters appearing at the same indexes as those inmatchChars
.- Returns:
- The number of replacements made.
-
replace
public static int replace(java.lang.StringBuffer stringBuffer, java.lang.String replaceString, java.lang.String withString)
Deprecated.Replaces every occurrence of a specified string with another string.- Parameters:
stringBuffer
- The string buffer in which the information will be replaced.replaceString
- The string to replace.withString
- The string that will replace replaceString.- Returns:
- The number of replacements made.
-
replaceRuns
public static java.lang.StringBuffer replaceRuns(java.lang.StringBuffer stringBuffer, char matchChar, int minRunLength, int maxRunLength, char replaceChar)
Deprecated.Replaces all runs of the given character with another character. A run is subsequent repeated characters. If a run is shorter thanminRunLength
or longer thanmaxRunLength
, it will be ignored.- Parameters:
stringBuffer
- The string buffer to search.matchChar
- The char runs of which to replace.minRunLength
- The minimum number of subsequent characters before replacement.maxRunLength
- The maximum number of subsequent characters before replacement.replaceChar
- The character that will replace all matching runs.- Returns:
- The string buffer with all matching character runs replaced.
-
replace
public static java.lang.StringBuffer replace(java.lang.StringBuffer stringBuffer, int startIndex, int endIndex, char replaceChar)
Deprecated.Removes several characters at the specified index and replaces them with the given character. This duplicatesStringBuffer.replace
functionality without the overhead of a string.- Parameters:
stringBuffer
- The buffer in which the information will be replaced.startIndex
- The index of the information to remove.endIndex
- One character past the last of the information to remove; must be greater thanstartIndex
.replaceChar
- The character to replace the removed characters.- Returns:
- The string buffer with the specified contents replaced.
- See Also:
StringBuffer.replace(int, int, java.lang.String)
-
startsWith
public static boolean startsWith(java.lang.StringBuffer stringBuffer, java.lang.String string)
Deprecated.Determines if the string buffer starts with the given string.- Parameters:
stringBuffer
- The string buffer to examine.string
- The string to compare.- Returns:
true
if the first characters of the string buffer match those of the given string.
-
trim
public static java.lang.StringBuffer trim(java.lang.StringBuffer stringBuffer, java.lang.String delimiters)
Deprecated.Trims the specified delimiters from the beginning and end of the string buffer.- Parameters:
stringBuffer
- The characters to be processed.delimiters
- The string containing delimiter characters.- Returns:
- The trimmed string buffer.
-
trimEnd
public static java.lang.StringBuffer trimEnd(java.lang.StringBuffer stringBuffer, java.lang.String delimiters)
Deprecated.Trims the specified delimiters from the end of the string buffer.- Parameters:
stringBuffer
- The characters to be processed.delimiters
- The string containing delimiter characters.- Returns:
- The trimmed string buffer.
-
-