Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to put two strings into one line 1

Status
Not open for further replies.

stewang

Programmer
Aug 21, 2003
77
NZ
Code:
Hello:
Please tell me how to put two strings into one line.

 My coding as follow;
   puts "the first ...."
   puts "the second...."
 when I run with the command wish test.tcl, it output as follow;
   the first...
   the second....
  but this is not I want, I want the result like follow;
   the first...the second.... 

and I don't want my code like follow
    puts "the first...the second"

Thanks
 
Take a look at concat.

set one "one...."
set two "and two...."
set out [concat $one $two]


 
marsd solution is a good solution.
Another way to do what you want:
Code:
  puts -nonewline $one
  puts $two
The -nonewline option tells puts not to add a new line to the outputted string.

For more on puts:
HTH

ulis
 
Thanks a lot, you both solution are quit helpfull.

rgds
stewang
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top