Link to home
Start Free TrialLog in
Avatar of bubwit
bubwit

asked on

Creating a white space

Is there an existing class in Java wherein I can use just say create 50 spaces and start displaying a string in the text Area?

I don't like to create a method that just loop and create a space with append the string I want.
ASKER CERTIFIED SOLUTION
Avatar of Calron
Calron

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Mick Barry
This should be a bit faster:

char[] spaces = new char[50];
Arrays.fill(spaces, ' ');
String s = new String(spaces);
Avatar of udaykumar22
udaykumar22

Hi,

I think this would be the fastest ;-)

String Str = new String("                                                 ");

Regards,
Uday.
No comment has been added lately, so it's time to clean up this TA.

I will leave a recommendation in the Cleanup topic area that this question is:

- points to Calron

Please leave any comments here within the
next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !

girionis
Cleanup Volunteer