public class Spaces extends Object
Modifier and Type | Field and Description |
---|---|
static CharSequence |
MAX
The longest possible string of spaces.
|
Modifier and Type | Method and Description |
---|---|
static Appendable |
append(Appendable buf,
int n)
Appends
n spaces to an Appendable . |
static PrintWriter |
append(PrintWriter pw,
int n)
Appends
n spaces to a PrintWriter . |
static StringBuffer |
append(StringBuffer buf,
int n)
Appends
n spaces to a StringBuffer . |
static StringBuilder |
append(StringBuilder buf,
int n)
Appends
n spaces to a StringBuilder . |
static StringWriter |
append(StringWriter pw,
int n)
Appends
n spaces to a StringWriter . |
static String |
of(int n)
Returns a string of
n spaces. |
static String |
padLeft(String string,
int n)
Returns a string that is padded on the left with spaces to the given
length.
|
static String |
padRight(String string,
int n)
Returns a string that is padded on the right with spaces to the given
length.
|
static CharSequence |
sequence(int n)
Creates a sequence of
n spaces. |
public static final CharSequence MAX
Use with StringBuilder.append(CharSequence, int, int)
to
append spaces without doing memory allocation.
public static CharSequence sequence(int n)
n
spaces.public static String of(int n)
n
spaces.public static Appendable append(Appendable buf, int n) throws IOException
n
spaces to an Appendable
.IOException
public static PrintWriter append(PrintWriter pw, int n)
n
spaces to a PrintWriter
.public static StringWriter append(StringWriter pw, int n)
n
spaces to a StringWriter
.public static StringBuilder append(StringBuilder buf, int n)
n
spaces to a StringBuilder
.public static StringBuffer append(StringBuffer buf, int n)
n
spaces to a StringBuffer
.public static String padRight(String string, int n)
Copyright © 2012–2018 The Apache Software Foundation. All rights reserved.