[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: one line to generate n spaces?
Keep and array of char with what you think may be the max amount
of spaces needed then use the static string function:
String copyValueOf(char data, int offset, int count)
Pull out as many spaces as you would like.
From: Kevin Leeds [mailto:email@example.com]
Sent: Thursday, November 15, 2001 12:27 PM
Subject: one line to generate n spaces?
Is there a method in JDK 1.1.8 to construct a
String of n spaces without using a loop?
I've attempted to look in the API for it -
String, StringBuffer, reflect.Array.
public static String padding(int n)
StringBuffer b = new StringBuffer();
for (int i=0; i<n; i++) b.append(' ');