<bdo id='nQUDv'></bdo><ul id='nQUDv'></ul>

      1. <small id='nQUDv'></small><noframes id='nQUDv'>

      2. <legend id='nQUDv'><style id='nQUDv'><dir id='nQUDv'><q id='nQUDv'></q></dir></style></legend>
        <i id='nQUDv'><tr id='nQUDv'><dt id='nQUDv'><q id='nQUDv'><span id='nQUDv'><b id='nQUDv'><form id='nQUDv'><ins id='nQUDv'></ins><ul id='nQUDv'></ul><sub id='nQUDv'></sub></form><legend id='nQUDv'></legend><bdo id='nQUDv'><pre id='nQUDv'><center id='nQUDv'></center></pre></bdo></b><th id='nQUDv'></th></span></q></dt></tr></i><div id='nQUDv'><tfoot id='nQUDv'></tfoot><dl id='nQUDv'><fieldset id='nQUDv'></fieldset></dl></div>
      3. <tfoot id='nQUDv'></tfoot>
      4. 如何将数字格式化为相同的位数,0填充?

        时间:2023-09-29

          <bdo id='IYQIZ'></bdo><ul id='IYQIZ'></ul>

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

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

                <legend id='IYQIZ'><style id='IYQIZ'><dir id='IYQIZ'><q id='IYQIZ'></q></dir></style></legend>
                  <tfoot id='IYQIZ'></tfoot>
                  本文介绍了如何将数字格式化为相同的位数,0填充?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我有几个不同长度的字符串

                  I have several strings of different length

                  "2323"
                  "245"
                  "353352"
                  

                  我需要将它们转换为相同大小的字符串,例如:

                  I need to convert them to string of the same size such as:

                  "0002323"
                  "0000245"
                  "0353352"
                  

                  如何在每个字符串前面自动添加正确数量的 0?

                  How can I automatically add the correct number of 0s in front of each string ?

                  谢谢

                  推荐答案

                  使用String.format:

                  Integer i = Integer.valueOf(src);
                  String format = "%1$07d";
                  String result = String.format(format, i);
                  

                  这篇关于如何将数字格式化为相同的位数,0填充?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:我们可以使用 String.format() 用所需长度的字符填充 下一篇:java中的txt文件格式验证

                  相关文章

                  最新文章

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

                  1. <tfoot id='K9efI'></tfoot>
                  2. <small id='K9efI'></small><noframes id='K9efI'>