aspose file tools*
The moose likes Java in General and the fly likes Remove Currency Format - Can i parse back to a double? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Remove Currency Format - Can i parse back to a double?" Watch "Remove Currency Format - Can i parse back to a double?" New topic
Author

Remove Currency Format - Can i parse back to a double?

Marcus Hathaway
Ranch Hand

Joined: Jun 07, 2005
Posts: 89
Hi,

Is it possible to remove a currency format?

For instance i start with a double, e.g. 10.00.

Applying code like below will give the string �10.00.



However, i now want to be able to convert that string back to its double value. Anyone know how i can do this?

Also, its not possible for me to use the original double!

Any advice would be greatly appreciated!

Cheers


David Weitzman
Ranch Hand

Joined: Jul 27, 2001
Posts: 1365
This isn't a swing-specific question, so I'm moving it to JiG intermediate.
Garrett Rowe
Ranch Hand

Joined: Jan 17, 2006
Posts: 1296
Try this:

Hope it helps. Just a note, the parse(String) method will return a long if possible so for your original example it will return a long with a value of 10. Therefore to insure that the final value is a double you must invoke the doubleValue() method.
Garrett
[ January 21, 2006: Message edited by: Garrett Rowe ]

Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them. - Laurence J. Peter
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Remove Currency Format - Can i parse back to a double?
 
Similar Threads
double
2 Questions 1) Conversion, 2) Use of the modulo/remainder operator
Regional settings
formatting amount
Localized Currency formatting issue