Ê×Ò³
ѧϰ
»î¶¯
רÇø
¹¤¾ß
TVP
·¢²¼
¾«Ñ¡ÄÚÈÝ/¼¼ÊõÉçȺ/ÓŻݲúÆ·,¾¡ÔÚС³ÌÐò
Á¢¼´Ç°Íù

do_decimal_point

Defined in header <locale>

?

?

public: CharT decimal_point() const;

(1)

?

protected: virtual CharT do_decimal_point() const;

(2)

?

1%29¹«¹²³ÉÔ±º¯Êý£¬µ÷ÓóÉÔ±º¯Êýdo_decimal_point×îÅÉÉúµÄÀà¡£

2%29·µ»Ø»õ±ÒI/OÖÐÓÃ×÷СÊýµã·Ö¸ô·ûµÄ×Ö·û£¬Èç¹û¸ñʽʹÓ÷ÖÊý%28£¬¼´Èç¹ûdo_frac_digits()´óÓÚ0%29¡£¶ÔÓÚµäÐ͵ÄÃÀ¹úµØÇøÀ´Ëµ£¬ÕâÊÇÒ»¸ö×Ö·û'.'%28»òL'.'%29

·µ»ØÖµ

ÀàÐͶÔÏóCharT±£³ÖСÊýµã×Ö·û¡£

Àý

¶þ´Î

´úÂëÓïÑÔ£ºjavascript
¸´ÖÆ
#include <iostream>
#include <iomanip>
#include <locale>
 
void show_dpt(const char* locname)
{
    std::locale loc(locname);
    std::cout.imbue(loc);
    std::cout << locname << " decimal point is '"
              << std::use_facet<std::moneypunct<char>>(loc).decimal_point()
              << "' for example: " << std::showbase << std::put_money(123);
    if (std::use_facet<std::moneypunct<char>>(loc).frac_digits() == 0)
        std::cout << " (does not use frac digits) ";
 
    std::cout << '\n';
}
 
int main()
{
    show_dpt("en_US.utf8");
    show_dpt("ja_JP.utf8");
    show_dpt("sv_SE.utf8");
    show_dpt("de_DE.utf8");
 
}

¶þ´Î

²ú³ö£º

¶þ´Î

´úÂëÓïÑÔ£ºjavascript
¸´ÖÆ
en_US.utf8 decimal point is '.' for example: $1.23
ja_JP.utf8 decimal point is '.' for example: £¤123 (does not use frac digits)
sv_SE.utf8 decimal point is ',' for example: 1,23 kr
de_DE.utf8 decimal point is ',' for example: 1,23 €

¶þ´Î

Áí¼û

do_frac_digits virtual

provides the number of digits to display after the decimal point (virtual protected member function)

´úÂëÓïÑÔ£ºtxt
¸´ÖÆ
 ? cppreference.com

ÔÚCreativeCommonsAttributionÏÂÊÚȨ-ShareAlikeδÒÆÖ²Ðí¿Év3.0¡£

ɨÂë¹Ø×¢ÌÚѶÔÆ¿ª·¢Õß

ÁìÈ¡ÌÚѶÔÆ´ú½ðȯ

http://www.vxiaotou.com