can you use DecimalFormat
http://java.sun.com/j2se/1
just type cast your string to number
Main Topics
Browse All TopicsI've been Googling around and all the solutions I can find pertain to the String formatter in Java 1.5... However, I'm using Java 1.4.2 so I can't exactly apply those solutions.
Is there a graceful way to handle this kind of formatting...?
String x = "0000002136608" (the length of the string is always 13 characters)
I want this to be formatted to look like this: "21,366.08"
So basically, how do you format in such a way that:
1) Leading zeroes are dropped
2) The last two digits are placed to the right of the decimal point
3) The digits to the left are separated by a comma after every 3 characters
More examples:
"0000001076855" = "10,768.55"
"0000000536777" = "5,367.77"
"0000000536163" = "5,361.63"
Thanks!
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
can you use DecimalFormat
http://java.sun.com/j2se/1
just type cast your string to number
So here's what's happening for example:
double xx = Integer.parseInt("00000000
DecimalFormat myFormatter = new DecimalFormat("##,###,###,
String output = myFormatter.format(xx);
This is the value of xx = 23490.0
This is the value of output = "23,490"
I'm still missing something... wonder what's wrong.
Business Accounts
Answer for Membership
by: objectsPosted on 2009-03-11 at 19:36:59ID: 23864297
convert it to n int
m.au/java/ how-to-con vert-a-str ing- to-an- int
m.au/java/ how-to-for mat-a-doub le- as-a-st ring
http://helpdesk.objects.co
divide it by 100 and store value as a double
then use a DecimalFormat to format it as a string
http://helpdesk.objects.co