📄 class.numberformatter.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head> <title>The NumberFormatter class</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="collator.sort.html">Collator::sort</a></div> <div class="next" style="text-align: right; float: right;"><a href="numberformatter.create.html">NumberFormatter::create</a></div> <div class="up"><a href="book.intl.html">intl</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div> <h1 class="title">The NumberFormatter class</h1> <div class="partintro"> <div id="numberformatter.intro" class="section"> <h2 class="title">Introduction</h2> <p class="simpara"> Programs store and operate on numbers using a locale-independent binary representation. When displaying or printing a number it is converted to a locale-specific string. For example, the number 12345.67 is "12,345.67" in the US, "12 345,67" in France and "12.345,67" in Germany. </p> <p class="simpara"> By invoking the methods provided by the NumberFormatter class, you can format numbers, currencies, and percentages according to the specified or default locale. NumberFormatter is locale-sensitive so you need to create a new NumberFormatter for each locale. NumberFormatter methods format primitive-type numbers, such as double and output the number as a locale-specific string. </p> <p class="para"> For currencies you can use currency format type to create a formatter that returns a string with the formatted number and the appropriate currency sign. Of course, the NumberFormatter class is unaware of exchange rates so, the number output is the same regardless of the specified currency. This means that the same number has different monetary values depending on the currency locale. If the number is 9988776.65 the results will be: <ul class="simplelist"> <li class="member">9 988 776,65 鈧
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -