in out examples :
4.00000, 4
5.12000 5.12
9.6066, 9.6066
code explains its self
8))
4.00000, 4
5.12000 5.12
9.6066, 9.6066
Code:
public static String floatTrimmer(String str1) {
String tempStr = str1.substring(str1.length() - 1);
if (!str1.contains(".")) {
return str1;
}
if (tempStr.equals("0") || tempStr.equals(".")) {
return floatTrimmer(str1.substring(0, str1.length() - 1));
}
return str1;
}
code explains its self
8))