Emmanuel Eze wrote:
>Does anyone know any java class or method that will enable me repeat a
>character n times?
>
>Example: if I want "******", I will call methodname('*',6).
>
Here is a simple method I wrote just last week to do that (actually two
overloaded ones). It is not fancy, but it works.
String repeatChar (int numChars) {
return repeatChar (numChars, ' ');
}
String repeatChar (int numChars, char aChar) {
char[] charList = new char[numChars];
for( int i = 0; i < numChars; i++)
charList[i] = aChar;
return new String(charList);
}
hth,
Tomm
To change your membership options, refer to:
http://www.sys-con.com/java/list.cfm