public class ClearableStringBuilder extends Object
StringBuilder
object, providing utility methods for clearing
it.Constructor and Description |
---|
ClearableStringBuilder() |
Modifier and Type | Method and Description |
---|---|
ClearableStringBuilder |
append(char ch)
Appends a character to the buffer.
|
ClearableStringBuilder |
append(char[] buffer,
int start,
int length)
Appends a character array to the buffer.
|
ClearableStringBuilder |
append(CharSequence string)
Appends a character sequence to the buffer.
|
ClearableStringBuilder |
chop()
Removes the last character from the buffer.
|
ClearableStringBuilder |
clear()
Clears the buffer.
|
String |
get()
Gets the buffer's contents.
|
String |
getAndClear()
Gets the buffer's contents, then clears it.
|
int |
length()
Gets the length of the buffer.
|
public ClearableStringBuilder()
public ClearableStringBuilder clear()
public String getAndClear()
public ClearableStringBuilder append(char ch)
ch
- the character to appendpublic ClearableStringBuilder append(CharSequence string)
string
- the character sequence to appendpublic ClearableStringBuilder append(char[] buffer, int start, int length)
buffer
- the characters to appendstart
- the index of the first char to appendlength
- the number of chars to appendpublic ClearableStringBuilder chop()
public int length()
Copyright © 2012–2020 Michael Angstadt. All rights reserved.