Format a price
@param mixed $value
@param string $currency
@param bool $withSymbol
@return string
178644
public static function currencyFormat($value, $currency = 'EUR', bool $withSymbol = true): string
    {
        $number = number_format((float) $value, 2, '.', ',');
        switch ($currency) {
            case 'EUR' : 
                return $number . ($withSymbol ? ' €' : '');
            case 'DOL' : 
                return ($withSymbol ? '$' : '') . $number;
            default : 
                return $number;
        }
    }
1271998
def format_price(self, price):
        
        return u"{} {}{}{:02d}".format(
            self.currency_symbol,
            price[0],
            self.decimal_mark,
            price[1],
        )
478240
public function decimal($values, string $currency = null, int $decimal_points = 2): string
    {
        [$className, $value] = $this->classAndValue($values, $currency);

        return (new $className)->decimal($value, $decimal_points);
    }
983215
public function format($money = null)
    {
        if (!$money) {
            return null;
        } else {
            return $this->numberFormatter->formatCurrency(
                $money->amount,
                $money->currency->code
            );
        }

    }
695174
public function transform($value): ?string
    {
        if (null === $value) {
            return '';
        }

        if (!$value instanceof MoneyValue) {
            throw new TransformationFailedException('Expected a MoneyValue object.');
        }

        if (!$this->formatter) {
            $this->formatter = new DecimalMoneyFormatter(new ISOCurrencies());
        }

        if (!$value->withCurrency) {
            return $this->formatter->format($value->value);
        }

        return ((string) $value->value->getCurrency()).' '.$this->formatter->format($value->value);
    }
684096
public function formatMoney(Money $money, $decPoint = ',', $thousandsSep = ' ')
    {
        $symbol = $this->formatCurrency($money);
        $amount = $this->formatAmount($money, $decPoint, $thousandsSep);
        $price = $amount." ".$symbol;

        return $price;
    }
26005
public function money($number, $currency, $decimals = null)
    {
        $format = $this->getFormat(self::MONEY);
        $numeric = $this->number($number, $decimals);
        return str_replace(['{number}', '{currency}'], [$numeric, $currency], $format);
    }
473429
public static function format($value)
    {
        $formatFunction = Config::get('shop.display_price_number_format') ?: function($price) { return number_format($price, 2); };
        return preg_replace(
            [
                '/:symbol/',
                '/:price/',
                '/:currency/'
            ],
            [
                Config::get('shop.currency_symbol'),
                $formatFunction($value),
                Config::get('shop.currency')
            ],
            Config::get('shop.display_price_format')
        );
    }
513353
function getCurrencySymbol(code, format, locale) {
    if (locale === void 0) { locale = 'en'; }
    var currency = getLocaleCurrencies(locale)[code] || CURRENCIES_EN[code] || [];
    var symbolNarrow = currency[1 /* SymbolNarrow */];
    if (format === 'narrow' && typeof symbolNarrow === 'string') {
        return symbolNarrow;
    }
    return currency[0 /* Symbol */] || code;
}
647020
public function format(
        $price,
        $digits = null,
        $locale = null,
        $currency = null,
        $currencyPosition = self::CURRENCY_LOCATION_NONE
    ) {
        if (is_null($locale)) {
            $locale = $this->defaultLocale;
        }

        if (is_null($digits)) {
            $digits = $this->defaultDigits;
        }

        $formatter = $this->getFormatter($locale, $digits);
        $formattedPrice = $formatter->format($price);

        if ($currencyPosition != self::CURRENCY_LOCATION_NONE && is_null($currency)) {
            throw new PriceFormatterException('currency must be set, if location is set');
        }

        switch ($currencyPosition) {
            case self::CURRENCY_LOCATION_PREFIX:
                $formattedPrice = $currency . ' ' . $formattedPrice;
                break;
            case self::CURRENCY_LOCATION_SUFFIX:
                $formattedPrice = $formattedPrice . ' ' . $currency;
                break;
        }

        return $formattedPrice;
    }
693651
public function formatMoney($amount, $currency = '€')
    {
        $symbols = array('€', '$', '£', '¥', '₤', 'kr', '₺');

        switch ($this->locale) {

            case 'de':
            case 'tr':
            case 'pt':
                $amount = number_format($amount, 2, ',', '.');
                $space = ' ';
                $format = is_string($currency) ? $amount.$space.$currency : $amount;
                break;

            case 'it':
            case 'nl':
                $amount = number_format($amount, 2, ',', '.');
                $space = ' ';
                $format = is_string($currency) ? $currency.$space.$amount : $amount;
                break;

            case 'fr':
                $amount = number_format($amount, 2, ',', ' ');
                $space = ' ';
                $format = is_string($currency) ? $amount.$space.$currency : $amount;
                break;            

            case 'ru':
                $amount = number_format($amount, 2, ',', ' ');
                $space = in_array($currency, $symbols) ? '' : ' ';
                $format = is_string($currency) ? $amount.$space.$currency : $amount;
                break;

            default:
            case 'en':
                $amount = number_format($amount, 2, '.', ',');
                $space = in_array($currency, $symbols) ? '' : ' ';
                $format = is_string($currency) ? $currency.$space.$amount : $amount;
                break;
        }

        return $format;
    }
341087
public function round($value, $currency = null)
    {
        return round($value, $this->precision, $this->mode);
    }
214196
protected function formatValue($value)
    {
        if (is_string($value)
            && !is_numeric($value)
        ) {
            $value = html_entity_decode($value, ENT_COMPAT, 'UTF-8');
        } elseif ($value === false) {
            $value = 0;
        }

        $value = $this->formatFormulas($value);

        if (is_string($value)
            && (strpos($value, '"') !== false
                || strpos($value, $this->separator) !== false)
        ) {
            $value = '"' . str_replace('"', '""', $value) . '"';
        }

        // in some number formats (e.g. German), the decimal separator is a comma
        // we need to catch and replace this
        if (is_numeric($value)) {
            $value = (string)$value;
            $value = str_replace(',', '.', $value);
        }

        return $value;
    }
275853
private function getValue(array $values, string $currency = null): string
    {
        $currency = !is_null($currency) ? strtolower($currency) : $this->provider->get();

        $values = array_change_key_case($values);

        return $values[$currency];
    }
827080
private function formatValue($value)
    {
        if ($value === '') {
            return '';
        }

        if ($value === null) {
            return '<comment>Null</comment>';
        }

        if (is_bool($value)) {
            return '<comment>' . ($value ? 'True' : 'False') . '</comment>';
        }

        if (empty($value)) {
            return '<comment>Empty</comment>';
        }

        if (is_array($value)) {
            return json_encode($value, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
        }

        if (is_object($value)) {
            return sprintf('<%s>', get_class($value));
        }

        if (is_scalar($value)) {
            return $value;
        }

        throw new InvalidArgumentException(sprintf('Do not know how to format value "%s"', print_r($value, true)));
    }
884262
def price_value_renderer(value, currency=None, **options):
    """"""
    if not currency:
        currency = getattr(settings, 'CURRENCY', 'USD')
    return format_currency(value, currency, locale=utils.get_current_locale())
348886
public function withPostfix($values, string $currency = null, int $decimal_points = null): string
    {
        [$className, $value] = $this->classAndValue($values, $currency);

        return (new $className)->postfix($value, $decimal_points);
    }