public class StatementBuilder
extends java.lang.Object
StringBuilder buff = new StringBuilder();
for (int i = 0; i < args.length; i++) {
if (i > 0) {
buff.append(", ");
}
buff.append(args[i]);
}
to
StatementBuilder buff = new StatementBuilder();
for (String s : args) {
buff.appendExceptFirst(", ");
buff.append(a);
}
| Constructor and Description |
|---|
StatementBuilder()
Create a new builder.
|
StatementBuilder(java.lang.String string)
Create a new builder.
|
| Modifier and Type | Method and Description |
|---|---|
StatementBuilder |
append(char c)
Append a character.
|
StatementBuilder |
append(long x)
Append a number.
|
StatementBuilder |
append(java.lang.String s)
Append a text.
|
void |
appendExceptFirst(java.lang.String s)
Append a text, except when this method is called the first time.
|
void |
appendOnlyFirst(java.lang.String s)
Append a text, but only if appendExceptFirst was never called.
|
int |
length()
Get the length.
|
StatementBuilder |
resetCount()
Reset the loop counter.
|
java.lang.String |
toString() |
public StatementBuilder()
public StatementBuilder(java.lang.String string)
string - the initial stringpublic StatementBuilder append(java.lang.String s)
s - the text to appendpublic StatementBuilder append(char c)
c - the character to appendpublic StatementBuilder append(long x)
x - the number to appendpublic StatementBuilder resetCount()
public void appendOnlyFirst(java.lang.String s)
s - the text to appendpublic void appendExceptFirst(java.lang.String s)
s - the text to appendpublic java.lang.String toString()
toString in class java.lang.Objectpublic int length()