Copy link to clipboard
Copied
Lets say I have a numeric list like this.
mylist ="1,5,11,17,19"
Now I need to remove just 11 from the mylist. (delete_value = 11)
How do I remove the delete_value from mylist
Its like the opposite of ListAppend?
So I need the new list to be ("1,5,17,19")
That UDF should do the trick then.
--
Adam
Copy link to clipboard
Copied
Before answering the question comprehensively, what would you expect to happen if 11 was in the list twice? Just remove the first instance of it? Or remove all instances of it?
Basically, you can use listFind() to locate the index point at which the list item is at, then use listDeleteAt() to get rid. You would need to continue to do this until there were not matches from the listFind() if you wanted to lose them all.
CFLib has a UDF which does this sort of thing for you already: http://www.cflib.org/udf/ListRemoveByString
--
Adam
Copy link to clipboard
Copied
Adam,
I would want all instances of the value removed from the list.
Copy link to clipboard
Copied
That UDF should do the trick then.
--
Adam
Copy link to clipboard
Copied
Thank you! I always forget about CFLIB
Copy link to clipboard
Copied
weezerboy, have you checked www.cflib.org for utilities that can do things like this?