1. <legend id='6I5Hj'><style id='6I5Hj'><dir id='6I5Hj'><q id='6I5Hj'></q></dir></style></legend><tfoot id='6I5Hj'></tfoot>

          <bdo id='6I5Hj'></bdo><ul id='6I5Hj'></ul>
      1. <small id='6I5Hj'></small><noframes id='6I5Hj'>

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

        在 Console.WriteLine 方法中格式化字符串

        Format Strings in Console.WriteLine method(在 Console.WriteLine 方法中格式化字符串)

        <small id='732bp'></small><noframes id='732bp'>

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

              <legend id='732bp'><style id='732bp'><dir id='732bp'><q id='732bp'></q></dir></style></legend>
              <tfoot id='732bp'></tfoot>

                • 本文介绍了在 Console.WriteLine 方法中格式化字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  我是 C# 编程新手.谁能解释一下下面的代码:

                  Im new to C# programming. Can someone please explain the following code:

                  Console.WriteLine( "{0}{1,10}", "Face", "Frequency" ); //Headings
                  Console.WriteLine( "{0,4}{1,10}",someval,anotherval);
                  

                  我知道这会打印带有给定标题的两列值,并且 {0} 指的是给定的第一个参数.但是 {x,y} 形式的格式字符串是什么意思呢?

                  I understand that this prints two columns of values with the headings given, and {0} refers to the first argument given. But what is the meaning of the format strings of the form {x,y} ?

                  推荐答案

                  向左添加填充.以下备忘单对于记住各种字符串格式模式非常有用:

                  It adds padding to the left. Very useful for remembering the various string formatting patterns is the following cheat sheet:

                  .NETString.Format 备忘单

                  正值向左添加内边距,负数向右侧添加内边距

                  Positive values add padding to the left, negative add padding to the right

                  Sample                                 Generates
                  String.Format("[{0, 10}]", "Foo");     [Foo]
                  String.Format("[{0, 5}]", "Foo");      [Foo]
                  String.Format("[{0, -5}]", "Foo");     [Foo]
                  String.Format("[{0, -10}]", "Foo");    [Foo]
                  

                  这篇关于在 Console.WriteLine 方法中格式化字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Force JsonConvert.SerializeXmlNode to serialize node value as an Integer or a Boolean(强制 JsonConvert.SerializeXmlNode 将节点值序列化为整数或布尔值)
                  Using JSON to Serialize/Deserialize TimeSpan(使用 JSON 序列化/反序列化 TimeSpan)
                  Could not determine JSON object type for type quot;Classquot;(无法确定类型“Class的 JSON 对象类型.)
                  How to deserialize a JSONP response (preferably with JsonTextReader and not a string)?(如何反序列化 JSONP 响应(最好使用 JsonTextReader 而不是字符串)?)
                  how to de-serialize JSON data in which Timestamp it-self contains fields?(如何反序列化时间戳本身包含字段的JSON数据?)
                  JSON.Net custom contract serialization and Collections(JSON.Net 自定义合约序列化和集合)
                      <tbody id='FMClc'></tbody>
                    • <bdo id='FMClc'></bdo><ul id='FMClc'></ul>
                    • <i id='FMClc'><tr id='FMClc'><dt id='FMClc'><q id='FMClc'><span id='FMClc'><b id='FMClc'><form id='FMClc'><ins id='FMClc'></ins><ul id='FMClc'></ul><sub id='FMClc'></sub></form><legend id='FMClc'></legend><bdo id='FMClc'><pre id='FMClc'><center id='FMClc'></center></pre></bdo></b><th id='FMClc'></th></span></q></dt></tr></i><div id='FMClc'><tfoot id='FMClc'></tfoot><dl id='FMClc'><fieldset id='FMClc'></fieldset></dl></div>
                    • <legend id='FMClc'><style id='FMClc'><dir id='FMClc'><q id='FMClc'></q></dir></style></legend>

                      • <tfoot id='FMClc'></tfoot>
                        1. <small id='FMClc'></small><noframes id='FMClc'>