[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Re: array to hash

Chad Perrin

3/20/2007 8:31:00 PM

On Tue, Mar 20, 2007 at 08:33:09PM +0900, Servando Garcia wrote:
> <html><head><meta name="Generator" content="PSI HTML/CSS Generator"/>
> <style type="text/css"><!--
> body{font-family:'Tahoma';font-size:10pt;font-color:'#000000';}
> LI{display:list-item;margin:0.00in;}
> p{display:block;margin:0.00in;}
> body{}
> --></style>
> </head><BODY ><div><SPAN style="font-family:'Arial';font-size:10pt;">Hello all</SPAN></div>
> <div><SPAN style="font-family:'Arial';font-size:10pt;">&nbsp; &nbsp; Is there a method to collect the items in an array into a hash</SPAN></div>
> <div>&nbsp;</div>
> <div><SPAN style="font-family:'Arial';font-size:10pt;">I want to go from this X =[1,2,3,4,5,6] to this Y={1 =&gt;2, 3 =&gt;4, 5 =&gt;6}</SPAN></div>
> <div>&nbsp;</div>
> <div><SPAN style="font-family:'Arial';font-size:10pt;">Just seems like there should be one</SPAN></div>
> <div>&nbsp;</div>
> <div><SPAN style="font-family:'Arial';font-size:10pt;">Thanks in advance</SPAN></div>
> <div>&nbsp;</div>
> <div><SPAN style="font-family:'Arial';font-size:10pt;">Sam</SPAN></div>
> </body></html>
>

I'm glad you got the answer you were seeking. I have a request, though:

Please provide plain text email content in the future. Some of us
(intentionally) avoid HTML email.

--
CCD CopyWrite Chad Perrin [ http://ccd.ap... ]
unix virus: If you're using a unixlike OS, please forward
this to 20 others and erase your system partition.