i was trying to get the index of a certain value in a list...
set foo [list 1 2 3 4 5]
so if I wanted the index of the value of 4? I tried googling but didn't have much luck..anyone done this before?
I tried using this guy:
string index string charIndex
and a few others..
pflynn
2
You are looking for something like the lsearch command:
% set foo [list 1 2 3 4 5]
1 2 3 4
% lsearch $foo 4
3
# the -integer option is reasonable here, since we are searching into a list of integers:
% lsearch -integer $foo 4
3
Tcl Built-In Commands - lsearch manual page