i have tcl list of strings
set NameList [list 'foo' 'moo 1' 'too 1 3' 'Enterprise 1']
and i try to check if "foo" is in the list but i get false
set test "foo"
if {[lsearch -exact $NameList $test] >= 0} {
return 1
}
UPDATE
i changed the Double quotes with single quote BUT i set the Variable test with "foo"
but still it doesn't work
lsearch -exact $NameList "foo"
will return 0, which represents the index of the elementfoo
in the listNameList
. – Dinesh"'foo'"
– glenn jackman