For Programmers: Free Programming Magazines  


Home > Archive > Tcl > August 2007 > Re: How to insert a newline to a line without displaying that









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: How to insert a newline to a line without displaying that
Fredderic

2007-08-24, 4:27 am

On Thu, 23 Aug 2007 11:46:04 +0100,
Jonathan Bromley <jonathan.bromley@MYCOMPANY.com> wrote:

> Try
> append AddText \n
> or, if you find that too alarming,
> append AddText "\n"
> or even (NOT nice!)
> append AddText {
> }
> (note that the braces contain just a literal newline).


There's always one of my favourite ways...

set text [list]
lappend text "First Line"
lappend text "Second Line"
puts [join $text \n]

It leaves the text [foreach]able until the very last moment. You just
have to remember that initial [set], or something similar (unless
you're certain the variable doesn't exist at all, and don't mind it
being a PITA to read).


Fredderic
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com