how to delete a element from a list
set a 'bolt cbar 7mm up'
#how to delete cbar from this list
lremove command is working when written directly in the command window but while executing as a procedure it is not executing.
Answers
-
set a [lreplace $a 1 1]
you can redefine lremove proc like this (to use outside of hyperworks scope):
proc ::lremove args {
set list [lindex $args 0]
set ritems [lrange $args 1 end]
#set result [lmap item $list {if {[lsearch -exact $ritems $item]==-1} {set item} else continue}]
set result {}
foreach item $list {
if {[lsearch -exact $ritems $item]==-1} {lappend result $item}
}
set result
}
0 -
hi tinh,
thank you for your support. like I solved this issue by
set a 'bolt cbar 7mm up'
set a [lremove $a cbar]
puts $a
bolt 7mm up
now this was working...
0