xtd 0.2.0
Loading...
Searching...
No Matches
__currency_formatter.h
Go to the documentation of this file.
1
3#pragma once
5#if !defined(__XTD_CORE_INTERNAL__)
6#error "Do not include this file: Internal use only"
7#endif
9
10#include "__binary_formatter.h"
11
12#include <cmath>
13#include <iomanip>
14#include <locale>
15#include <sstream>
16
18template<typename char_t>
19inline std::basic_string<char_t> __currency_formatter(long double value, const std::locale& loc) {
20 std::basic_stringstream<char_t> ss;
21 ss.imbue(loc);
22 ss << std::showbase << std::fixed << std::put_money(value * std::pow(10, std::use_facet<std::moneypunct<char_t>>(loc).frac_digits()));
23 return ss.str();
24}
Contains __binary_formatter method.