i need to concatenate 8-length() of 0's before a string that has as length: lenght(). In other words i have to write a loop that will print out (if needed!) 0's in front of a string ... in order to make it a 8 charachter string
P.S. I can not believe that java does not have a function that prints a charachter n-times. Or does it?
Joel McNary
Bartender
Joined: Aug 20, 2001
Posts: 1815
posted
0
It doesn't, but you can easily write your own:
Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
Michael Dunn
Ranch Hand
Joined: Jun 09, 2003
Posts: 4632
posted
0
Another way, perhaps String pad = "00000000"; String str = "12345"; str = pad.substring(0,pad.length()-str.length())+str; System.out.println(str);
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.