ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ivan Ivanov <rambiusparkisan...@yahoo.com>
Subject Re: stripping chars from property
Date Sat, 04 Jun 2005 14:45:20 GMT
Hello Henrik,

Here is one way to do this using ant-contrib[1] and
its task <propertyregex>[2]:

<project>
  <taskdef
  resource="net/sf/antcontrib/antcontrib.properties"/>
  <property name="ext.version" value="4.0.0"/>
  <propertyregex property="ext.version.undotted"
    input="${ext.version}"
    regexp="\." replace=""/>
  <echo>$${ext.version.undotted} is
${ext.version.undotted}</echo>
</project>

The output of this build file is:
[echo] ${ext.version.undotted} is 400.

There are also other ways to do it, like using
<scriptdef> and a scripting language like javascript
to do the string manipulation, but I think the one
above is the easiest.

HTH Ivan

[1] http://ant-contrib.sourceforge.net/
[2]http://ant-contrib.sourceforge.net/tasks/tasks/propertyregex.html

--- Henrik Gemal <spamreg@mail.dk> wrote:

> I have the following:
> <property file="ext.version" value="4.0.0" />
> 
> Now I need to create a file with the version in it's
> name but without 
> the . (dots) something like:
> blabla400.zip
> 
> So is there a way to convert the ${ext.version} into
> a new property 
> without the dots?
> 
> I need this to be a generic way since I'm using the
> build.xml file in 
> different places
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> user-help@ant.apache.org
> 
> 



		
__________________________________ 
Discover Yahoo! 
Find restaurants, movies, travel and more fun for the weekend. Check it out! 
http://discover.yahoo.com/weekend.html 


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


Mime
View raw message