Page 1 of 1
[Solved] Removing items from a delimited list
Posted: Mon May 13, 2019 6:40 pm
by redfield
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)

.
Re: Removing items from a delimited list
Posted: Mon May 13, 2019 6:49 pm
by Klaus
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
Re: Removing items from a delimited list
Posted: Mon May 13, 2019 7:04 pm
by dunbarx
Hi.
What Klaus said.
Now check out "offset" in the dictionary. There are a dozen different forms, each tailored to your needs.
Craig Newman
Re: Removing items from a delimited list
Posted: Mon May 13, 2019 7:52 pm
by redfield
Ouch - I knew it would hurt

!
Thank you so much Klaus!
Re: Removing items from a delimited list
Posted: Mon May 13, 2019 7:56 pm
by redfield
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

.
Re: Removing items from a delimited list
Posted: Mon May 13, 2019 8:16 pm
by Klaus
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!
