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
201 views
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 808 views
+2 votes
2 answers 809 views
–1 vote
0 answers 153 views
+6 votes
2 answers 2,954 views
+1 vote
1 answer 908 views
+4 votes
5 answers 770 views
+2 votes
1 answer 177 views
+1 vote
1 answer 175 views
0 votes
0 answers 111 views
0 votes
0 answers 81 views

Not a Member yet?

Ask to Folks Login

My Account
694 Folks are online
6 members and 688 guest online
Your feedback is highly appreciated