You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Karunakar Chatla <ka...@cybage.com> on 2005/08/22 18:58:52 UTC

How to insert new line character in a string

Hi,

I have following script where I am writing some text to file.
I wanted each of the lines in seperate line in the file. It is writing to the file but when I open the file(in windows) it shows me a special character( a sqare).
How can we avoid this? 

<concat destfile="${soft.labels.path}\${soft-lable-win}">
 element * CHECKEDOUT
 time ${timerule} 
 ${load.rules}
 </concat>

Thanks,
Karunakar Chatla

  

Re: How to insert new line character in a string

Posted by Dadu The Dude <sa...@yahoo.com>.
Use this my friend: 

        <echo file="${basedir}/project/Readme.txt" append="false">This is
the first line A & # x D ; (Remove Spaces) 
This is the second line B  & # x D ; (Remove Spaces) 
</echo> 


<echo file="...">This is the first line A 
This is the second line B 
</echo> 

Regards,
Amit

-- 
View this message in context: http://old.nabble.com/How-to-insert-new-line-character-in-a-string-tp682311p29125745.html
Sent from the Ant - Users mailing list archive at Nabble.com.


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


Re: How to insert new line character in a string

Posted by EJ Ciramella <ec...@archivas.com>.
You could also try ${line.separator}

See:
http://ant.apache.org/manual/CoreTasks/property.html
http://ant.apache.org/manual/using.html#built-in-props
http://java.sun.com/j2se/1.3/docs/api/java/lang/ 
System.html#getProperties()

On Aug 22, 2005, at 1:10 PM, Andrew Goktepe wrote:

> On second glance, it looks like that only applies to the fixlastline
> attribute.
>  If you can't find any other solution, you could try the ugly way -  
> put
> &#013;&#010; at the end of each line. I haven't tested this either.
>
>  On 8/22/05, Andrew Goktepe <an...@gmail.com> wrote:
>
>>
>> Try setting eol="crlf":
>>  http://ant.apache.org/manual/CoreTasks/concat.html
>>  -Andrew
>>
>>  On 8/22/05, Karunakar Chatla <ka...@cybage.com> wrote:
>>
>>>
>>>
>>> Hi,
>>>
>>> I have following script where I am writing some text to file.
>>> I wanted each of the lines in seperate line in the file. It is  
>>> writing
>>> to the file but when I open the file(in windows) it shows me a  
>>> special
>>> character( a sqare).
>>> How can we avoid this?
>>>
>>> <concat destfile="${soft.labels.path}\${soft-lable-win}">
>>> element * CHECKEDOUT
>>> time ${timerule}
>>> ${load.rules}
>>> </concat>
>>>
>>> Thanks,
>>> Karunakar Chatla
>>>
>>>
>>>
>>>
>>
>


Re: How to insert new line character in a string

Posted by Andrew Goktepe <an...@gmail.com>.
On second glance, it looks like that only applies to the fixlastline 
attribute. 
 If you can't find any other solution, you could try the ugly way - put 
&#013;&#010; at the end of each line. I haven't tested this either.

 On 8/22/05, Andrew Goktepe <an...@gmail.com> wrote: 
> 
> Try setting eol="crlf":
>  http://ant.apache.org/manual/CoreTasks/concat.html
>  -Andrew
> 
>  On 8/22/05, Karunakar Chatla <ka...@cybage.com> wrote: 
> > 
> > 
> > Hi,
> > 
> > I have following script where I am writing some text to file.
> > I wanted each of the lines in seperate line in the file. It is writing 
> > to the file but when I open the file(in windows) it shows me a special 
> > character( a sqare). 
> > How can we avoid this?
> > 
> > <concat destfile="${soft.labels.path}\${soft-lable-win}">
> > element * CHECKEDOUT
> > time ${timerule}
> > ${load.rules}
> > </concat>
> > 
> > Thanks,
> > Karunakar Chatla 
> > 
> > 
> > 
>

Re: How to insert new line character in a string

Posted by Andrew Goktepe <an...@gmail.com>.
Try setting eol="crlf":
 http://ant.apache.org/manual/CoreTasks/concat.html
 -Andrew

 On 8/22/05, Karunakar Chatla <ka...@cybage.com> wrote: 
> 
> 
> Hi,
> 
> I have following script where I am writing some text to file.
> I wanted each of the lines in seperate line in the file. It is writing to 
> the file but when I open the file(in windows) it shows me a special 
> character( a sqare).
> How can we avoid this?
> 
> <concat destfile="${soft.labels.path}\${soft-lable-win}">
> element * CHECKEDOUT
> time ${timerule}
> ${load.rules}
> </concat>
> 
> Thanks,
> Karunakar Chatla
> 
> 
>