user3352565
user3352565

Reputation: 1

Tcl: spaces in command substitution

I have a function which outputs a string with or without spaces. I want to set a variable to the function output. I use the following command:

set name [get_name_function object]    

The problem is that if object name contains spaces (i.e. name with spaces), the whole name is putted in curly braces (name is equal to {name with spaces}). How can I get the correct name?

Upvotes: 0

Views: 129

Answers (1)

glenn jackman
glenn jackman

Reputation: 246764

It sounds like get_name_function is returning a Tcl list, not a string. You might want to use

set name [join [get_name_function object] " "]

Upvotes: 1

Related Questions