concrete/src/Utility/Service/Number.php
public function trim($value)
    {
        $result = '';
        $value = (string) $value;
        if ($value !== '') {
            // Temporarily remove leadin sign
            $sign = $value[0];
            if ($sign === '-' || $sign === '+') {
                $value = substr($value, 1);
            } else {
                $sign = '';
            }
            if ($value !== '') {
                // Remove initial zeroes
                $value = ltrim($value, '0');
                if ($value === '' || $value[0] === '.') {
                    $value = '0' . $value;
                }
                if (strpos($value, '.') !== false) {
                    // Remove trailing zeroes after the dot
                    $value = rtrim(rtrim($value, '0'), '.');
                }
                $result = $sign . $value;
            }
        }

        return $result;
    }
public function trim($value)
    {
        $result = '';
        $value = (string) $value;
        if ($value !== '') {
            // Temporarily remove leadin sign
            $sign = $value[0];
            if ($sign === '-' || $sign === '+') {
                $value = substr($value, 1);
            } else {
                $sign = '';
            }
            if ($value !== '') {
                // Remove initial zeroes
                $value = ltrim($value, '0');
                if ($value === '' || $value[0] === '.') {
                    $value = '0' . $value;
                }
                if (strpos($value, '.') !== false) {
                    // Remove trailing zeroes after the dot
                    $value = rtrim(rtrim($value, '0'), '.');
                }
                $result = $sign . $value;
            }
        }

        return $result;
    }
public function trim ( $ value ) { $ result = '' ; $ value = ( string ) $ value ; if ( $ value !== '' ) { // Temporarily remove leadin sign $ sign = $ value [ 0 ] ; if ( $ sign === '-' || $ sign === '+' ) { $ value = substr ( $ value , 1 ) ; } else { $ sign = '' ; } if ( $ value !== '' ) { // Remove initial zeroes $ value = ltrim ( $ value , '0' ) ; if ( $ value === '' || $ value [ 0 ] === '.' ) { $ value = '0' . $ value ; } if ( strpos ( $ value , '.' ) !== false ) { // Remove trailing zeroes after the dot $ value = rtrim ( rtrim ( $ value , '0' ) , '.' ) ; } $ result = $ sign . $ value ; } } return $ result ; }
Remove superfluous zeroes from a string containing a number.

@param string $value (decimal separator is dot)

@return string
Remove superfluous zeroes from a string containing a number .