I use Java to determine the length of a double as part of a larger program. At this time, double is 666, but the length is returned as 5, which is a big problem. I read another question posted here with a solution, but this did not work for me. I will show my code and try to imitate the previous solution with the results.
My source code:
double Real = 666;
int lengthTest = String.valueOf(Real).trim().length();
System.out.println("Test: " + lengthTest);
Prints 5
Modifications that didn't work, and essentially just split the code into multiple lines.
double Real = 666;
String part = Real + "";
part = part.trim();
int newLength = part.length();
System.out.println("new length : " + newLength);
It also prints 5.
Obviously, I want this to print how many numbers I have, in which case it should show 3.
, , , . ..: xx.yyezz, xx 5 , yy 5 , zz 2 . .