[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

convert Currency back to double

Posted on 2006-10-24
2
Medium Priority
?
1,211 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 9

Accepted Solution

by:
shinobun earned 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses

649 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