demo currency skill

Creamer

Well-known member
#5
Java:
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;
    }
this trims the out put :
2.09 dollars becomes 2.09 dollars
3.00 dollars becomes 3 dollars

 
Top