Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Remove item from numeric list

Participant ,
Feb 28, 2013 Feb 28, 2013

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")

880
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Feb 28, 2013 Feb 28, 2013

That UDF should do the trick then.

--

Adam

Translate
LEGEND ,
Feb 28, 2013 Feb 28, 2013

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Feb 28, 2013 Feb 28, 2013

Adam,

I would want all  instances of the value removed from the list.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 28, 2013 Feb 28, 2013

That UDF should do the trick then.

--

Adam

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Feb 28, 2013 Feb 28, 2013
LATEST

Thank you! I always forget about CFLIB

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Feb 28, 2013 Feb 28, 2013

weezerboy, have you checked www.cflib.org for utilities that can do things like this?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources