Duplicate values

  • Creator
    Topic
  • #50991
    Bala Pisupati
    Participant

    I have a variable

    ex:

    set PID [lindex $x $i]

    now $PID has

    1

    2

    3

    1

    5

    4

    can any one tell me how i can seperated the duplicates

    if $PIDhas more than 1 value

    do something}else {

    do something}

Viewing 1 reply thread
  • Author
    Replies
    • #68319
      Tom Rioux
      Participant

      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

    • #68320
      Bala Pisupati
      Participant

      Thanks Thomas

      Yes i am trying to remove the duplicates.

      It worked.  🙂

Viewing 1 reply thread
  • The forum ‘Cloverleaf’ is closed to new topics and replies.

Forum Statistics

Registered Users
4,964
Forums
28
Topics
9,103
Replies
33,613
Topic Tags
248