Clovertech
› Clovertech Forums › Read Only Archives › Cloverleaf › Cloverleaf › Duplicate values
I have a variable
ex:
set PID [lindex $x $i]
now $PID has
1
2
3
5
4
can any one tell me how i can seperated the duplicates
if $PIDhas more than 1 value
do something}else {
do something}
Not sure exactly what you are asking. Are you wanting to remove duplicates from a list? If so, try this:
hcitcl>set PID “1 2 3 1 5 4”
1 2 3 1 5 4
hcitcl>set newPID [lrmdups $PID]
1 2 3 4 5
Hope this helps…
Tom
Thanks Thomas
Yes i am trying to remove the duplicates.
It worked. 🙂