Alex Rivera | Logout

How to convert from fraction formatted string to Decimal or Float in Java?

Asked 2012-11-06T11:17:01.840
9

I have few string values which I am fetching from my database e.g

"1/4","2/3"

But while displaying as Android ListView contents I need to display it as 0.25,0.66.

Now I don't want to split the string and then covert to individual strings to numbers and then divide them to have result.

Does anyone know, any direct functions like Double.valueOf or parseDouble kind?

Edit
Report

1 Answer

1

In java, we don't have anything like the eval from JavaScript so you could possibly use this.

answered 2012-11-06T11:30:13.420

Your Answer