:D
My turn!
Delete elements in a list in a given alias:
Summary:
delfromlistend - delete a given number of list elements from the end of a given list
delfromliststart - delete a given number of list elements from the beginning of a given list
delfromlist - delete a given element from a given list
delfromlist_mult - delete multiple arbitrary elements from a given list
Example, for those who remember this:
/alias testlist [I do not like CubeScript]
/echo $testlist
I do not like CubeScript
/echo (delfromlist_mult $testlist [do not])
I like CubeScript
My turn!
Delete elements in a list in a given alias:
[SELECT ALL] Code:
alias delfromlistend [
delalias tmp_list
loop df (- (listlen $arg1) $arg2) [
add2list tmp_list (at $arg1 $df)
]
result (getalias tmp_list)
] // echo (delfromlistend $testlist 3)
alias delfromliststart [
delalias tmp_list
loop df (- (listlen $arg1) $arg2) [
add2list tmp_list (at $arg1 (+ $df $arg2))
]
result (getalias tmp_list)
] // echo (delfromliststart $testlist 3)
alias delfromlist [
delalias tmp_list
loop df (listlen $arg1) [
if (strcmp (at $arg1 $df) $arg2) [] [
add2list tmp_list (at $arg1 $df)
]
]
result (getalias tmp_list)
] // echo (delfromlist $testlist k)
alias delfromlist_mult [
alias tmp_list1 $arg1
loop mu (listlen $arg2) [alias tmp_list1 (delfromlist $tmp_list1 (at $arg2 $mu))]
result (getalias tmp_list1)
] // echo (delfromlist_mult $testlist [a c e g i k])
delfromlistend - delete a given number of list elements from the end of a given list
delfromliststart - delete a given number of list elements from the beginning of a given list
delfromlist - delete a given element from a given list
delfromlist_mult - delete multiple arbitrary elements from a given list
Example, for those who remember this:
/alias testlist [I do not like CubeScript]
/echo $testlist
I do not like CubeScript
/echo (delfromlist_mult $testlist [do not])
I like CubeScript