0 votes
721 views
in Programming by (2.8k points)
Hello I have a string containing decimal values now I want to remove decimal values and want to make it double.
 
I am trying this: 
Like String A = "34000.898989";
int a =Integer.parseInt(A); 
String result = String.format
 
But not working.Please help me out!
closed

1 Answer

+1 vote
by (1.4k points)
selected by
 
Best answer

You have parse the string like this,After then you can remove decimals from the string
See this code.


 String A = "34000.898989";

 double bDouble = Double.parseDouble(A);
 int finalA = (int)bDouble;
              
 

I hope you got my point.

0
by (530 points)
@jack you are right, its the right way to convert a string.
0
by (2.8k points)
Thanks @jack i got my answer. :)

Not a Member yet?

Ask to Folks Login

My Account

Your feedback is highly appreciated