public function format($format)
    {
        // Sprintf and unit regex
        $pattern = '/(%(?:\d+\$)?[+-]?(?:[ 0]|\'.{1})?-?\d*(?:\.\d+)?[bcdeEufFgGosxX])(.*)/';

        // Check if string has sprintf and unit...
        if (preg_match_all($pattern, $format, $m)) {
            // Valid format, save to instance.
            $this->format = $format;

            // Get sprintf and units
            $sprintf = $m[1][0];
            $unit    = $m[2][0];

            // Try to find value of instance at specified units.
            $value = $this->{trim($unit)};
            if ($value == 0) {
                $value = $this->{strtolower(trim($unit))};
                if ($value == 0) {
                    $value = $this->{strtoupper(trim($unit))};
                }
            }

            // Should just display as scientific notation?
            if (sprintf($sprintf, $value) == 0 || $value > 10e9) {
                // Change sprintf to use e for scientific notation
                $sprintf = preg_replace('/[bcdeEufFgGosxX]/', 'e', $sprintf);
            }

            // Return value with format and unit suffix.
            return sprintf($sprintf, $value) . $unit;
        } else {
            // No valid format found, use old format.
            if (preg_match_all($pattern, $this->format, $m)) {
                return $this->format(
                  str_replace(trim($m[2][0]), '', $m[0][0]) . $format);
            }
        }
    }