Doubt on
Formatting a Number
I have a doubt pls anybody clarify it...... I have a String which gets "3600000".....I am converting it to number as 3600000. But it should be displayed as 36000.00 ie., thirty six thousands.I tried with number formatter but not getting it. Is it possible with number formatter...Is so pls tell me how.. Raju About ur query----- You can simply achieve this by applying
String
Hope your problem would have been solved by this. Alpana Thank you for your reply. I think you didn't get my question. I am able to convert string to number.
but before the last two digits of my number I have to put a dot(.)
Raja 1. convert it to a float/double instead of a double; 2. convert to a string; 3. find the position of the ., and use substring to limit the string to that position +2; Jonathan Roberts Will this work? String s = "36000";
Vinay I guess I made a typo in my earlier reply, I am sorry. String s = "3600000",s2; StringBuffer s1 = new StringBuffer(s);
Anyways, if you meant you want to display 36000.00 as a number, then I got no idea how to do it. Because after you do float a = Float.parseFloat(s2); it will be displayed as 36000.0 but not as 36000.00. Vinay
Do you have a Java Problem?
Java Books
Return to : Java Programming Hints and Tips All the site contents are Copyright © www.erpgreat.com
and the content authors. All rights reserved.
|