Hey there! any question in your mind? Ask It Now!.

Popular Categories

Best way to Convert a String having Decimal point to Double?

0 votes
asked in Programming by monika (2,040 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!

1 Answer

+1 vote
answered by jack (1,440 points)
selected by monika
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.

commented by raman (530 points)
@jack you are right, its the right way to convert a string.
commented by monika (2,040 points)
Thanks @jack i got my answer. :)

Related Questions

+3 votes
1 answer 912 views
–1 vote
0 answers 192 views
+6 votes
2 answers 3,554 views
+2 votes
1 answer 224 views
0 votes
0 answers 114 views

Not a Member yet?

Ask to Folks Login

My Account
313 Folks are online
0 members and 313 guest online
Your feedback is highly appreciated