From: Lokesh Agrawal Date: 2008-05-12T18:08:13+09:00 Subject: Re: Convert integer to array? Integer to Array x=1234 y=x.to_s.scan(\/d\) or y=x.to_s.split(//) or y=x.to_s.split('') Array to integer z=y.to_s.to_i Thanks and Regards, Lokesh Agrawal Software Engineer ---------------------------------------------------------------------------- ---------- "Dream is not what you see in sleep, is the the thing which does not let you sleep" ---------------------------------------------------------------------------- ---------- -----Original Message----- From: Peņa, Botp [mailto:botp@delmonte-phil.com] Sent: Monday, May 12, 2008 2:19 PM To: ruby-talk ML Subject: Re: Convert integer to array? From: kaepora@mac.com [mailto:kaepora@mac.com] # Let's say I have: x=1234 # How can I convert that to the follow array: x=[1, 2, 3, 4] irb is friendly, just play w it.. "1234".split(//) #=> ["1", "2", "3", "4"] your next task is to convert those into integers, then you're good to go.. kind regards -botp DISCLAIMER ========== This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails.