Solved

convert Currency back to double

Posted on 2006-10-24
2
1,194 Views
Last Modified: 2008-02-01
If i've used the following code to convert a double into formatted currency is there any way to convert back?

for instance:

NumberFormat FormatCurrency = NumberFormat.getCurrencyInstance();
String sBalance = FormatCurrency.format(5100.25);

now that sBalance = $5,100.25 how could I convert this back to 5100.25 as a double?

Thanks
0
Comment
Question by:mgcIT
2 Comments
 
LVL 9

Accepted Solution

by:
shinobun earned 500 total points
ID: 17798889
Use the parse method [1].

Number number = FormatCurrency.parse(sBalance);
double asDouble = number.doubleValue();

http://java.sun.com/j2se/1.5.0/docs/api/java/text/NumberFormat.html#parse(java.lang.String)
0
 
LVL 18

Author Comment

by:mgcIT
ID: 17799652
perfect... thanks
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now