Salut Ludo !
 
If you wish to format a number, depending on a specified locale, you can convert your Float with some classes found in the java.text package. You can specify a pattern for the resulting String.
 
DecimalFormat nf = (DecimalFormat)DecimalFormat.getInstance(Locale.FRENCH);
nf.applyPattern("#,##0.00");
// this pattern is very usefull for just keeping two digit for the decimal part (especially when dealing with currencies
Float myFloatNumber = 123456789.123456
String myFormattedString = nf.format(myFloatNumber);
// myFormattedString will be equal to "123 456 789,12" in the locale is French
// and it will be equal to "123,456,789.12" if the locale is English
 
Guillaume
----- Original Message -----
Sent: Wednesday, March 06, 2002 9:12 AM
Subject: display numbers

Hi,
I have to display numbers in a PDF document, but it's frequently thousands or
millions, so I would like to render it like this:
1 000 000 or 1'000'000
instead of 1000000
is it possible or may I write a fonction that convert it in a string before
rendering it??
Moreover, is the choice of the language including the rendering of numbers??
for exemple in France we use a coma and not a dot in numbers:
14,89 <=> 14.89

cheers,
Ludo.
 

-------------------------------------------------
    Webmail Saros: http://webmail.saros.fr

Reply via email to