You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

length.html 4.2 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <!--
  2. Licensed to the Apache Software Foundation (ASF) under one or more
  3. contributor license agreements. See the NOTICE file distributed with
  4. this work for additional information regarding copyright ownership.
  5. The ASF licenses this file to You under the Apache License, Version 2.0
  6. (the "License"); you may not use this file except in compliance with
  7. the License. You may obtain a copy of the License at
  8. http://www.apache.org/licenses/LICENSE-2.0
  9. Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is distributed on an "AS IS" BASIS,
  11. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. See the License for the specific language governing permissions and
  13. limitations under the License.
  14. -->
  15. <html>
  16. <head>
  17. <meta http-equiv="Content-Language" content="en-us">
  18. <link rel="stylesheet" type="text/css" href="../stylesheets/style.css">
  19. <title>Length Task</title>
  20. </head>
  21. <body>
  22. <h2>Length</h2>
  23. <p><em>Since Apache Ant 1.6.3</em></p>
  24. <h3>Description</h3>
  25. <p>Display or set a property containing length information for a string, a file, or one or more
  26. nested <a href="../Types/resources.html#collection">resource collections</a>. Can also be used as
  27. a <code>condition</code>.</p>
  28. <h3>Parameters</h3>
  29. <table class="attr">
  30. <tr>
  31. <th scope="col" rowspan="2">Attribute</th>
  32. <th scope="col" rowspan="2">Description</th>
  33. <th scope="col" colspan="2">Required</th>
  34. </tr>
  35. <tr>
  36. <th scope="col">Task</th>
  37. <th scope="col">Condition</th>
  38. </tr>
  39. <tr>
  40. <td>property</td>
  41. <td>The property to set.</td>
  42. <td class="center">No; by default, output value to the log</td>
  43. <td>Ignored</td>
  44. </tr>
  45. <tr>
  46. <td>mode</td>
  47. <td>File length mode; when <q>all</q> the resulting value is the sum of all included resources'
  48. lengths; when <q>each</q> the task outputs the absolute path and length of each included
  49. resource, one per line.</td>
  50. <td class="center">No; default is <q>all</q></td>
  51. <td>Ignored</td>
  52. </tr>
  53. <tr>
  54. <td>file</td>
  55. <td>Single file whose length to report.</td>
  56. <td rowspan="3" colspan="2">One of these, or one or more nested filesets</td>
  57. </tr>
  58. <tr>
  59. <td>resource</td>
  60. <td class="left">Single resource whose length to report (using
  61. extended <a href="../properties.html#propertyHelper">properties handling</a>). <em>Since Ant
  62. 1.8.1</em>
  63. </td>
  64. </tr>
  65. <tr>
  66. <td>string</td>
  67. <td class="left">The string whose length to report.</td>
  68. </tr>
  69. <tr>
  70. <td>trim</td>
  71. <td>Whether to trim when operating on a string.</td>
  72. <td colspan="2">No; default is <q>false</q>, ignored unless <var>string</var> is set</td>
  73. </tr>
  74. <tr>
  75. <td>length</td>
  76. <td>Comparison length.</td>
  77. <td class="center">Ignored</td>
  78. <td>Yes</td>
  79. </tr>
  80. <tr>
  81. <td>when</td>
  82. <td>Comparison
  83. type: <q>equal</q>, <q>eq</q>, <q>greater</q>, <q>gt</q>, <q>less</q>, <q>lt</q>, <q>ge</q>
  84. (greater or equal), <q>ne</q> (not equal), <q>le</q> (less or equal).</td>
  85. <td class="center">Ignored</td>
  86. <td>No; default is <q>equal</q></td>
  87. </tr>
  88. </table>
  89. <h3>Parameters specified as nested elements</h3>
  90. <h4>resource collections</h4>
  91. <p>You can include resources via nested <a href="../Types/resources.html#collection">resource
  92. collection</a>s.</p>
  93. <h3>Examples</h3>
  94. <p>Store the length of the string <q>foo</q> in the property named <code>length.foo</code>.</p>
  95. <pre>&lt;length string=&quot;foo&quot; property=&quot;length.foo&quot;/&gt;</pre>
  96. <p>Store the length of file <samp>bar</samp> in the property named <code>length.bar</code>.</p>
  97. <pre>&lt;length file=&quot;bar&quot; property=&quot;length.bar&quot;/&gt;</pre>
  98. <p>Store the file paths of <samp>foo</samp> and <samp>bar</samp> and their length into the
  99. property <code>length</code>.</p>
  100. <pre>
  101. &lt;length property=&quot;length&quot; mode=&quot;each&quot;&gt;
  102. &lt;fileset dir=&quot;.&quot; includes=&quot;foo,bar&quot;/&gt;
  103. &lt;/length&gt;
  104. </pre>
  105. <p>Add the length of <samp>foo</samp> and <samp>bar</samp> and store the result in
  106. property <code>length</code>.</p>
  107. <pre>
  108. &lt;length property=&quot;length&quot; mode=&quot;all&quot;&gt;
  109. &lt;fileset dir=&quot;.&quot; includes=&quot;foo,bar&quot;/&gt;
  110. &lt;/length&gt;
  111. </pre>
  112. </body>
  113. </html>