Page 1 of 2
How to remove empty items
Posted: Tue Apr 09, 2013 11:43 pm
by Yuroun
I'm building a semi modular effect. The user can select an effect on every slot, but when an effect is chosen, then in the other effect slot must the effect removed. I'd build some logic, but I have empty places. How can I remove them?
See my schematic

- select-fx.png (50.42 KiB) Viewed 23835 times
Re: How to remove empty items
Posted: Wed Apr 10, 2013 2:07 am
by briant1972
I found some ruby code online. Seems to work. Try out the attached module.
Re: How to remove empty items
Posted: Wed Apr 10, 2013 2:13 am
by Jay
Hi Yuroun
I would do it like below, all one line and no extra bits required
output @SourceString.gsub(@OldPattern,@NewPattern).each_line.reject{|x| x.strip == ""}.join
Best Regards
Re: How to remove empty items
Posted: Wed Apr 10, 2013 3:28 pm
by Yuroun
Thanks Guys. Both are elegant solutions. I prefer the version of Jay. He modified my Ruby code nicest

Re: How to remove empty items
Posted: Wed Apr 10, 2013 5:04 pm
by Jay
Why thank you Yuroun!
glad it is of use for you m8
Best regards
Re: How to remove empty items
Posted: Thu Apr 11, 2013 8:56 am
by Yuroun
Jay wrote:Why thank you Yuroun!
Because it's a normal thing to do, If you get some help.
For me it is

Re: How to remove empty items
Posted: Thu Apr 11, 2013 9:20 am
by nix
It's a mannerism in English Yuroun 8D
Or was that a good for a pun?
hehe
Re: How to remove empty items
Posted: Thu Apr 11, 2013 4:38 pm
by Yuroun
nix wrote:It's a mannerism in English Yuroun 8D
Or was that a good for a pun?
hehe
Lol

Re: How to remove empty items
Posted: Thu Apr 11, 2013 5:34 pm
by Yuroun
Here's the version I had in mind. It's not working perfectly
Re: How to remove empty items
Posted: Thu Apr 11, 2013 7:14 pm
by Jay
yeh its just a saying Yuroun

a bit like "well thank you very much"
I see what you mean about not working perfectly, it seems the last column does not always update properly, I will have a look at it and see what i can come up with
Best Regards