[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Remove from an array

Stefan Lang

8/20/2006 12:42:00 PM


On Sunday, August 20, 2006, at 7:33 PM, Robert Dober wrote:
>------=_Part_25421_29258161.1156070000118
>Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>Content-Transfer-Encoding: quoted-printable
>Content-Disposition: inline
>
>On 8/20/06, Paul Lutus <nospam@nosite.zzz> wrote:
>>
>> Hal Fulton wrote:
>>
>> > Paul Lutus wrote:
>> >> Nicolas Benady wrote:
>> >>
>> >>
>> >>>Hello,
>> >>>I have an array, let's name it items[]
>> >>>I want to remove an object in a elegant way
>> >>>items.remove(3) does not work
>> >>>How should I do ?
>> >>>Thanks
>> >>>
>> >>
>> >>
>> >> items.delete_at(3)
>> >>
>> >> Just like in the documentation.
>> >>
>> >
>> > Did he want to remove the element at index 3,
>> > or remove instances of 3?
>>
>> I suppose I should have asked that before replying. :)
>>
>> If your theory is correct, then:
>>
>> items.delete_if { |x| x =3D=3D 3 }
>
>items.delete 3
>
>> Removes all items matching "3".
>
>
>as you said
>
>Cheers
>Robert
>
>--
>> Paul Lutus
>> http://www.ara...
>>
>>
>

This is slightly off-topic, but...

To remove only the first item matching a value of 3, do this..

items.delete_at(items.index(3))

_Kevin
www.sciwerks.com

--
Posted with http://De.... Sign up and save your mailbox.

6 Answers

Tracey12

5/22/2013 5:03:00 PM

0

On May 22, 10:34 am, Yoorg...@Jurgis.net wrote:
> On Wed, 22 May 2013 03:53:09 -0700 (PDT), Tracey12
>
> <tracey12em...@gmail.com> wrote:
>
> >Rush is right.
>
> BWHAHAHAHAHAHA
>
> A fat, drug addict, purveyor of nonsense---is "right"
>
> A "right" smelly pile of shit, you mean.

Are you describing the Coke Sniffer you voted for?

dzweibach

5/22/2013 6:36:00 PM

0

Tracey12 <tracey12email@gmail.com> wrote:
> On May 22, 10:34=A0am, Yoorg...@Jurgis.net wrote:
> > On Wed, 22 May 2013 03:53:09 -0700 (PDT), Tracey12
> >
> > <tracey12em...@gmail.com> wrote:
> >
> > >Rush is right.
> >
> > BWHAHAHAHAHAHA
> >
> > A fat, drug addict, purveyor of nonsense---is "right"
> >
> > A "right" smelly pile of shit, you mean.
>
> Are you describing the Coke Sniffer you voted for?

Insulting! I didn't vote for Dubya!

George Kerby

5/22/2013 8:44:00 PM

0




On 5/22/13 12:02 PM, in article
6aa77b21-1c3f-459e-b10d-ebe4e3b82355@h13g2000yqe.googlegroups.com,
"Tracey12" <tracey12email@gmail.com> wrote:

> On May 22, 10:34?am, Yoorg...@Jurgis.net wrote:
>> On Wed, 22 May 2013 03:53:09 -0700 (PDT), Tracey12
>>
>> <tracey12em...@gmail.com> wrote:
>>
>>> Rush is right.
>>
>> BWHAHAHAHAHAHA
>>
>> A fat, drug addict, purveyor of nonsense---is "right"
>>
>> A "right" smelly pile of shit, you mean.
>
> Are you describing the Coke Sniffer you voted for?

Naw. He's providing you his Resume...

Vincenzo S Givens

5/23/2013 2:01:00 AM

0

Yoorghis: Real name Gary Richard Roselles. Before he was exposed he
changed his name every few days or weeks mainly because he's a
sociopathic coward, a pussy, and above all else a LIAR and a
time-waster. Gary is another example of a Complete Loser: He is
festering away in a one-bedroom apartment on Medicaid and Social
Security having wasted his entire life... (And he never served in the
US military...)

Gary uses "X-No-Archive: yes" in his message Header to force
server-side deletion of ALL of his posts and this is usually the only
way to detect his presence (unless you detect the strong odor of
shit).

Note that when you reply to a Proven Liar you encourage them to
continue lying.

Gary Richard Roselles (DoB: 11/1942)
(Diane M Roselles)
4215 Cedar Ridge Pl, Apt 42
Rapid City, SD 57702-3190
(605) 341-2445

Gary's real Email: rosell19@yahoo.com

[][][][][][]
The DemocRATs Hall Of Shame asks "Why do you always LIE?"

[Courtesy of Buster Norris]

On Mon, 01 Apr 2013 11:10:26 -0600, Yoorghis@Jurgis.net wrote:
>On Sun, 31 Mar 2013 21:42:24 -0700, Gunner Asch <gunnerasch@gmail.com>
>wrote:
>>On Sun, 31 Mar 2013 19:00:42 -0600, Wye@not.com wrote:
>>>Gee---how do you explain the 90% + who want Gun control?
>>>Hmmm?
>>1. Its hardly 90%, it was about 50%
>The only place where it's "50%" is a GOPUSA and Faux snooze, you
>mindless idiot
>National polling runs at 70-90%.

LIAR!!!!!!!!!!!!!!!!

CBS News Poll. March 20-24, 2013. "In general, do you think gun
control laws should be made more strict, less strict, or kept as they
are now?"

More strict 47%
Less strict OR Kept as they are 50%

"Do you favor or oppose a nationwide ban on semi-automatic weapons --
including some rifles, pistols, and shotguns -- that have detachable
magazines, allowing them to rapidly fire a high number of rounds?"
Favor 49%
Oppose 49%

Fox News Poll March 17-19, 2013. "Turning now to gun control: Which
one of the following do you think is most likely to reduce gun
violence? Stricter gun control laws for everyone. Better mental health
services. Better parenting."
Stricter gun control laws 26%
Better mental health services 24%
Better parenting 37%

http://pollingreport.co...

Posted on behalf of:
The DemocRATs Hall of Shame!

Caryl Blake Peltier-Loera

5/23/2013 2:01:00 AM

0

"Denny" is a Socialist-Communist Troll, a moderately retarded fool,
and a poor liar.

From: dzweibach@REMOVEyahoo.com (Denny)
X-No-Archive: yes

----------
Everything you need to know about 'Denny':
>Bret Cahill <BretCahill@peoplepc.com> wrote:
>> Holder needs to go after W. Bush & Cheney for using the IRS against
>> anti-quagmire activists and after they are safely behind bars then
>> we'll discuss Obama.
>...Those two have problems enough. We've all heard the rumors...Screaming
>nightmares, heavy drug use...leave them alone, let them suffer. Every time
>one of them see a Wounded Warrior ad on TV, their handlers have to hit them
>with the needle.
>MAY EVERY WAR-SUPPORTING RIGHT-WINGER SUFFER THE SAME.
[Emphasis mine - PG.]
----------

"Denny" posts a lot like a new version of that old brain-damaged idiot
"Ray Fischer."

Please note that when you reply to a Liar you encourage them to
continue lying.

[][][][][][]
The DemocRATs Hall Of Shame asks "Why do you always LIE?"

[Courtesy of Buster Norris]

On 06 Apr 2013 23:46:56 GMT, dzweibach@REMOVEyahoo.com (Denny) wrote:
>Lebanon is a democracy.

LIAR!!!!!!!!!!!!

Government type: This entry gives the basic form of government.

Democracy - a form of government in which the supreme power is
retained by the people, but which is usually exercised indirectly
through a system of representation and delegated authority
periodically renewed.

Republic - a representative democracy in which the people's elected
deputies (representatives), not the people themselves, vote on
legislation.

Lebanon - Government type: republic
https://www.cia.gov/library/publications/the-world-factbook/ge...

Posted on behalf of:
The DemocRATs Hall of Shame!

Harold Burton

5/23/2013 2:12:00 AM

0

In article <abppp8tnea35pobtpjbhsa1334mnu31k4k@4ax.com>,
Yoorghis@Jurgis.net wrote:

> On Wed, 22 May 2013 03:53:09 -0700 (PDT), Tracey12
> <tracey12email@gmail.com> wrote:
>
> >
> >Rush is right.
>
> BWHAHAHAHAHAHA
>
> A fat, drug addict, purveyor of nonsense---is "right"
>
> A "right" smelly pile of shit, you mean.

A troll, actually and he hooked you.


laugh . . . laugh . . . laugh