English 中文(简体)
ANT Tasks - Length
  • 时间:2024-09-17

Apache Ant Tasks - Length


Previous Page Next Page  

Description

Length task display or set a property containing length information for a string, a file, or one or more nested resource collections. It can also be used as a condition.

Properties

Sr.No Attributes & Description
1

Property

The property to set.

2

Mode

File length mode; when all the resulting value is the sum of all included resources lengths; when each the task outputs the absolute path and length of each included resource, one per pne.

3

File

Single file whose length to report.

4

Resource

Single resource whose length to report (using extended properties handpng).

5

String

The string whose length to report.

6

Trim

Whether to trim when operating on a string.

7

Length

Comparison length.

8

When

Comparison type: equal, eq, greater, gt, less, lt, ge (greater or equal), ne (not equal), le (less or equal).

Example

Usage

Create build.xml with the following content −


<?xml version="1.0"?>
<project name="TutorialPoint" default="info">
   <length string="tutorialspoint" property="text.size"/>
   <target name="info">            
      <echo message="${text.size}"/>
   </target>
</project>

Output

Running Ant on the above build file produces the following output −


F:	utorialspointant>ant
Buildfile: F:	utorialspointantuild.xml

info:
   [echo] 14

BUILD SUCCESSFUL
Total time: 0 seconds
Advertisements