Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / November 2005

Tip: Looking for answers? Try searching our database.

DecimalFormat without comma

Thread view: 
Jackson - 17 Nov 2005 00:47 GMT
I want to format the number without the comma.
int num = 1000.123;
java.text.numberFormat nf = java.text.numberFormat.getInstance();
nf.setMaximumFractionDigits( 10 );
nf.format( num );

this returns "1,000.123" but i want instead "1000.123" how can i do?

S
Roedy Green - 17 Nov 2005 01:21 GMT
>this returns "1,000.123" but i want instead "1000.123" how can i do?

see http://mindprod.com/jgloss/decimalformat.html
http://mindprod.com/applets/converter.html
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

Sujay - 17 Nov 2005 06:09 GMT
it is possible by defining a DecimalFormatt as "########.##0"
Pete Barrett - 17 Nov 2005 19:06 GMT
>I want to format the number without the comma.
>int num = 1000.123;
[quoted text clipped - 3 lines]
>
>this returns "1,000.123" but i want instead "1000.123" how can i do?

Try NumberFormat.setGroupingUsed(false).

Pete Barrett


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.