ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Knuplesch, Juergen" <Juergen.Knuple...@icongmbh.de>
Subject AW: How to concat string in ant
Date Fri, 05 Jun 2009 06:52:45 GMT
Hello,

You use antcontrib, there you have the var type that will do the trick.
In the end you should move the result into a property.

Initialize it:
		<var name="long-string.var" value= "" />
And in the loop:
		<var name="long-string.var" value= "${long-string} @{str}" />

And move it to property:
		<property name="long-string" value= "${long-string.var}" />

-- 
J├╝rgen Knuplesch

-----Urspr├╝ngliche Nachricht-----
Von: Gao Lin [mailto:aoingl@gmail.com] 
Gesendet: Freitag, 5. Juni 2009 08:45
An: user@ant.apache.org
Betreff: How to concat string in ant

Hi:

  I want to concat some strings from a list to one string line.

like:

<for list="${strs.list}" delimiter="," param="str">
	<sequential>
		<property name="long-string" value= " @{str}" />
                <!-- Because property is immutable,  the ${long-string}  is the first element
of the list: ${strs.list} -->
	</sequential>
</for>

for example above, if the list of ${strs.list} is:  {a, b, c}, how can I get a string with
value: string = "a b c" ?

do you guys know what is better way to implement this WITHOUT writing own Task?

--
Thanks and Best Regards

aoingl@gmail.com

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


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


Mime
View raw message