Actually my confusion starts at this point,
When i use this code , it does print each comma-delimited string ;but i wish
to do something like this
<echo>The value of String 1 : ${value1}</echo>
<echo>The value of String 2 : ${value2}. Now pass this to macro2 </echo>
<echo>The value of String 3 : ${value3}. Now pass this to macro3</echo>
To be able to achieve this I would need to distinguish between the String 1
and String 2. For e.g. value1 or value[1] or any concrete way to
differentiate between each of the strings
Thanks,
Rohit
Jan.Materne wrote:
>
> <loadfile property="data" srcfile="my.txt"/>
> <ac:for param="line" list="${data}" delimiter="${line.separator}">
> <sequential>
> <ac:for param="value" list="@{line}" delimiter=",">
> <sequential>
>
>
> Jan
>
>
>>-----Ursprüngliche Nachricht-----
>>Von: rohit15 [mailto:[email protected]]
>>Gesendet: Montag, 23. November 2009 11:07
>>An: [email protected]
>>Betreff: Parsing comma-separated string and getting handle to
>>each token
>>
>>
>>Hi gurus,
>>
>>Can you please help me resolve this seemingly simple requirement.
>>
>>I have a my.txt file like
>>localVariable1,propVariable11,propVariable12
>>localVariable2,propVariable21,propVariable22
>>localVariable3,propVariable31,propVariable32
>>
>>
>>I need to parse this line by line and then process each line. While
>>processing each line, I need to execute separate logic on the
>>2nd and 3rd
>>variables of each line.
>>
>>I've been able to parse each line using the following code. However, I
>>haven't succeeded in getting handle to 2nd and 3rd variables
>>by reference
>>[For e.g. in Java, I'd have iterated using stringtokenizer and
>>referred as
>>stringtkr.token[1], or token[2] -something on those lines]
>>
>>
>><macrodef name="printline">
>><attribute name="lineparam"/>
>><sequential>
>><echo>Line param :: @{lineparam}</echo>
>>
>><for list="@{lineparam}" param="testparam" delimiter=','>
>><sequential>
>><property name="@{testparam}" value="This is dummy value for
>>@{testparam}"/>
>><!-- How do I refer specifically to 1st token and then 2nd and
>>then 3rd? -->
>></sequential>
>></for>
>></sequential>
>></macrodef>
>>
>>
>>--
>>View this message in context:
>>http://old.nabble.com/Parsing-comma-separated-string-and-gettin
>>g-handle-to-each-token-tp26474937p26474937.html
>>Sent from the Ant - Users mailing list archive at Nabble.com.
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: [email protected]
>>For additional commands, e-mail: [email protected]
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
>
--
View this message in context:
http://old.nabble.com/Parsing-comma-separated-string-and-getting-handle-to-each-token-tp26474937p26478806.html
Sent from the Ant - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]