• <bdo id='dJ2kE'></bdo><ul id='dJ2kE'></ul>

    <small id='dJ2kE'></small><noframes id='dJ2kE'>

  • <i id='dJ2kE'><tr id='dJ2kE'><dt id='dJ2kE'><q id='dJ2kE'><span id='dJ2kE'><b id='dJ2kE'><form id='dJ2kE'><ins id='dJ2kE'></ins><ul id='dJ2kE'></ul><sub id='dJ2kE'></sub></form><legend id='dJ2kE'></legend><bdo id='dJ2kE'><pre id='dJ2kE'><center id='dJ2kE'></center></pre></bdo></b><th id='dJ2kE'></th></span></q></dt></tr></i><div id='dJ2kE'><tfoot id='dJ2kE'></tfoot><dl id='dJ2kE'><fieldset id='dJ2kE'></fieldset></dl></div>
    <legend id='dJ2kE'><style id='dJ2kE'><dir id='dJ2kE'><q id='dJ2kE'></q></dir></style></legend>
    <tfoot id='dJ2kE'></tfoot>

        Objective-C如何打印出浮点数的前导0?

        时间:2023-08-31
        <legend id='McQYN'><style id='McQYN'><dir id='McQYN'><q id='McQYN'></q></dir></style></legend>

        <small id='McQYN'></small><noframes id='McQYN'>

          <tbody id='McQYN'></tbody>
        <tfoot id='McQYN'></tfoot>

                <bdo id='McQYN'></bdo><ul id='McQYN'></ul>
              • <i id='McQYN'><tr id='McQYN'><dt id='McQYN'><q id='McQYN'><span id='McQYN'><b id='McQYN'><form id='McQYN'><ins id='McQYN'></ins><ul id='McQYN'></ul><sub id='McQYN'></sub></form><legend id='McQYN'></legend><bdo id='McQYN'><pre id='McQYN'><center id='McQYN'></center></pre></bdo></b><th id='McQYN'></th></span></q></dt></tr></i><div id='McQYN'><tfoot id='McQYN'></tfoot><dl id='McQYN'><fieldset id='McQYN'></fieldset></dl></div>
                • 本文介绍了Objective-C如何打印出浮点数的前导0?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  如何使用 NSString 类型为浮点数打印前导零?

                  How do you print out leading zeros for a float using the NSString type?

                  Input: 3.14
                  Desired output: 03.1
                  
                  Using format @"%02.1f"
                  Output: 3.1
                  

                  推荐答案

                  你想要 @"04.1f".4 是总宽度.

                  正如您从 文档,格式字符串符合IEEE printf 规范.

                  As you can see from the documentation, the format strings conform to the IEEE printf specification.

                  您指定的格式字符串分解如下:

                  The format string you've specified breaks down as follows:

                  0 -- 用零填充.
                  2 -- 整个生成的格式化值的最小宽度为 2.
                  .1 -- 小数点后一位精度.

                  0 -- Pad with zeros.
                  2 -- The entire resulting formatted value will have a minimum width of 2.
                  .1 -- Precision of 1 digit following the decimal point.

                  这篇关于Objective-C如何打印出浮点数的前导0?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:相对时间跨度的自定义格式 下一篇:将 .NET 中的 DateTime 对象格式化为 Objective-c 的 N

                  相关文章

                  最新文章

                  1. <tfoot id='Y8Heu'></tfoot>

                  2. <legend id='Y8Heu'><style id='Y8Heu'><dir id='Y8Heu'><q id='Y8Heu'></q></dir></style></legend>

                      <small id='Y8Heu'></small><noframes id='Y8Heu'>

                        <bdo id='Y8Heu'></bdo><ul id='Y8Heu'></ul>
                      <i id='Y8Heu'><tr id='Y8Heu'><dt id='Y8Heu'><q id='Y8Heu'><span id='Y8Heu'><b id='Y8Heu'><form id='Y8Heu'><ins id='Y8Heu'></ins><ul id='Y8Heu'></ul><sub id='Y8Heu'></sub></form><legend id='Y8Heu'></legend><bdo id='Y8Heu'><pre id='Y8Heu'><center id='Y8Heu'></center></pre></bdo></b><th id='Y8Heu'></th></span></q></dt></tr></i><div id='Y8Heu'><tfoot id='Y8Heu'></tfoot><dl id='Y8Heu'><fieldset id='Y8Heu'></fieldset></dl></div>