ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Garrett Smith" <dhtmlkitc...@gmail.com>
Subject Re: substring
Date Wed, 09 Jul 2008 06:21:46 GMT
On Tue, Jul 8, 2008 at 12:51 PM, Anthony Muller <anthony.muller@sap.com> wrote:
> Hello,
>
> Is it possible to do a substring operation with Ant?
>
Not exactly.

But it is possible to do a string/token replacement -- not exactly
what you asked, but it can get the job done. This is done using a
FilterChain, http://ant.apache.org/manual/CoreTypes/filterchain.html

I'm using this feature to replace certain strings in my files with the
empty string (removal). In the example below, I replace "from" with
"to"
from: "APE.namespace("APE.dom");"
to:    ""


http://dhtmlkitchen.com/ape/build.xml
<concat destfile="${src}/dom/_dom.js">
<filelist dir="${src}/dom" files="viewport-f.js, position-f.js,
classname-f.js, traversal-f.js, Event.js"/>
  <filterchain>
    <tokenfilter>
      <replacestring from="APE.namespace("APE.dom");" to=""/>
      <replacestring from="APE.namespace('APE.dom');" to=""/>
    </tokenfilter>
  </filterchain>
</concat>

Garrett

> Cheers,
> Anthony

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message