Formatting my String
Posted
by
pringlesinn
on Stack Overflow
See other posts from Stack Overflow
or by pringlesinn
Published on 2011-01-07T11:14:34Z
Indexed on
2011/01/07
13:54 UTC
Read the original article
Hit count: 235
java
|string-formatting
I need to write currency values like $35.40 (thirty five dollars and forty cents)
and after that, i want to write some "****"
so at the end it will be:
thirty five dollars and forty cents*********
in a maximun of 100 characters
I've asked a question about something very likely but I couldn't understand the main command.
String format = String.format("%%-%ds", 100);
String valorPorExtenso = String.format(format, new Extenso(tituloTO.getValor()).toString());
What do I need to change on format to put ***
at the end of my sentence?
The way it is now it puts spaces.
© Stack Overflow or respective owner