Regarding Java String dollar to cents conversion

Posted by arav on Stack Overflow See other posts from Stack Overflow or by arav
Published on 2010-03-09T05:29:07Z Indexed on 2010/03/09 5:36 UTC
Read the original article Hit count: 367

Filed under:
|
|

I have a java string which has an dollar value and cents value after decimal points and starting with a + or - sign. I want to convert into cents and store it in a integer (it can have + or -). Also i need to check if the cents part (after decimal point) not more than 2 digits and throw an error message if exists

example : String dollval= "12.23" ,"12","-0.09", "-99","-99.0", "-99.23","0.00" int dollint = 1223,12,-9,-99,-00,-9923,0

© Stack Overflow or respective owner

Related posts about java

Related posts about string