This is a very simple question, but I'm amazed on how difficult it has been to answer. Even the documentation didn't give a clear and straight answer.
You see, I'm simply trying to convert a simple float to a string such that the result only has one decimal digit. For example:
String myfloatstring = "";
float myfloat = 33.33;
myfloatstring = Float.toString(myfloat);
This does indeed return "33.33". This is fine, except I'm looking for a way to get it to truncate the decimal to "33.3". It also needs to impose a decimal whenever a whole number is put in. If myfloat was 10, for example, it would need to display as "10.0". Oddly not as simple as it sounds.
Any advice you can give me would be greatly appreciated.
EDIT #1:
For the moment, I'm not concerned with digits to the left of the decimal point.
returns:
Use the third example for your case