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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Escape a DOLLAR sign.

Status
Not open for further replies.

mbitzko

Programmer
Apr 5, 2005
13
US
How do you escape a string value containing a dollar sign to avoid TCL attempting to treat it as a variable. I have some values that I'm filling a table or form with that begin with a $ such as $1I045, and I want to pass the value through directly without treating it as a variable.
 
Maybe you don't need to do anything.

Code:
  set var {$12345}
  set list [list $var $var]
  puts $list

The {} protect a string from the Tcl interpretation of $.
Once in a value, the $ is ignored by Tcl (unless you use eval or uplevel).

ulis
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top