You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by sc...@accenture.com on 2008/04/17 00:08:09 UTC
Likely a common question - carriage return / new line in string literals in Velocity Script
I have a feeling this question has been answered many times, but I could not find a FAQ for the user mailing list, so here goes...
Is there any provision for including a new line / carriage return in a string literal in Velocity Script? This is important for formatting blocks of text within a proprietary application.
Thank you,
Scott Grunewald
scott.grunewald@accenture.com
AIM: ScottGrunewald
Office #: 905-804-6942
This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the email by you is prohibited.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org
Re: Likely a common question - carriage return / new line in string literals in Velocity Script
Posted by Nathan Bubna <nb...@gmail.com>.
if you are using Velocity 1.5, you can just put the new line in there:
#set( $foo = "this has a
line break" )
if you're using an earlier version, the easiest way is to just add one
to the context:
context.put("n","\n");
then in your template:
#set( $foo = "this has a${n}line break" )
On Wed, Apr 16, 2008 at 3:08 PM, <sc...@accenture.com> wrote:
> I have a feeling this question has been answered many times, but I could not find a FAQ for the user mailing list, so here goes...
>
> Is there any provision for including a new line / carriage return in a string literal in Velocity Script? This is important for formatting blocks of text within a proprietary application.
>
> Thank you,
>
> Scott Grunewald
> scott.grunewald@accenture.com
> AIM: ScottGrunewald
> Office #: 905-804-6942
>
>
> This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the email by you is prohibited.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org