JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
make format_decimal always omit the ".0" suffix
authorJason Woofenden <jason@jasonwoof.com>
Sat, 30 Jun 2012 06:24:49 +0000 (02:24 -0400)
committerJason Woofenden <jason@jasonwoof.com>
Sat, 30 Jun 2012 06:24:49 +0000 (02:24 -0400)
format.php

index 13d79ce..5d7c2bb 100644 (file)
@@ -72,8 +72,8 @@ function _format_positive_decimal($str) {
 
 function format_positive_decimal($str) {
        $str = _format_positive_decimal($str);
-       if($str === '0.0') {
-               $str = '0';
+       if(substr($str, -2) === '.0') {
+               $str = substr($str, 0, -2);
        }
        return $str;
 }