[Solved] Removing items from a delimited list

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
redfield
Posts: 95
Joined: Thu Apr 04, 2019 1:41 pm

[Solved] Removing items from a delimited list

Post by redfield » Mon May 13, 2019 6:40 pm

Hi guys,
I am trying to remove certain chars from a delimited list, thought this would be really easy, but I'm failing.

Code: Select all

combine theList using comma
# answer theList gives a,b,c,d,e,f,g,...z

put b,f into theItems

repeat for each item x in theItems
	put offset(x, theList) into y
	delete item y of theList
end repeat
Seemingly the delimiters are taken into account, so that the Offset result for 'b' for example, is 3 (a , b) instead of 2 (a b) :( .
Last edited by redfield on Sun Jun 16, 2019 12:50 pm, edited 1 time in total.

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Removing items from a delimited list

Post by Klaus » Mon May 13, 2019 6:49 pm

Hi redfield,

yes, "offset" is a CHARACTER offset, you want to use:

Code: Select all

...
repeat for each item x in theItems
   put ITEMoffset(x, theList) into y
...
That will work as advertized! :-)


Best

Klaus

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9582
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Removing items from a delimited list

Post by dunbarx » Mon May 13, 2019 7:04 pm

Hi.

What Klaus said.

Now check out "offset" in the dictionary. There are a dozen different forms, each tailored to your needs.

Craig Newman

redfield
Posts: 95
Joined: Thu Apr 04, 2019 1:41 pm

Re: Removing items from a delimited list

Post by redfield » Mon May 13, 2019 7:52 pm

Ouch - I knew it would hurt :? !
Thank you so much Klaus!

redfield
Posts: 95
Joined: Thu Apr 04, 2019 1:41 pm

Re: Removing items from a delimited list

Post by redfield » Mon May 13, 2019 7:56 pm

dunbarx wrote:
Mon May 13, 2019 7:04 pm
Now check out "offset" in the dictionary. There are a dozen different forms, each tailored to your needs.
Yes I see now. Only read the description of "offset" the whole time, without paying attention to further suggestions in the Name column of the dictionary :roll: .

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Removing items from a delimited list

Post by Klaus » Mon May 13, 2019 8:16 pm

redfield wrote:
Mon May 13, 2019 7:52 pm
Ouch - I knew it would hurt :? !
Thank you so much Klaus!
Don't worry, I won't tell anyone! 8)

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”