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

beginners guiding 1

Status
Not open for further replies.

kukelyk

Technical User
Mar 23, 2005
57
HU
hi
im new in tcl, im not a programmer, so i have many many problems...
my problem is finding the value of a numerical variable in a string.. how can i do this?
the string match command seems not to work..
thanks, kukelyk
 
There are probably more elegant ways but I use set and catch. Let's say you want to know if a variable, a, has a value. A statement, set a will return the value if it exists, or an error if it doesn't. You can catch the error: catch {set a} and that returns a 0 if there is no error and 1 if there is. So, for example:
if [catch {set a}] {
#there was an error; a is not set
} else {
#there was no error; a has a value
}


_________________
Bob Rashkin
rrashkin@csc.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top