Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.ruby > #3434

Re: Can I split the array from text?

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!talisker.lacave.net!lacave.net!not-for-mail
From Joey Zhou <yimutang@gmail.com>
Newsgroups comp.lang.ruby
Subject Re: Can I split the array from text?
Date Sun, 24 Apr 2011 08:35:34 -0500
Organization Service de news de lacave.net
Lines 11
Message-ID <f62f85247ec2e1df9d06ddccb69646a9@ruby-forum.com> (permalink)
References <f49ba0d3c9809988b28fc4042f50998a@ruby-forum.com>
NNTP-Posting-Host bristol.highgroove.com
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 7bit
X-Trace talisker.lacave.net 1303652702 7235 65.111.164.187 (24 Apr 2011 13:45:02 GMT)
X-Complaints-To abuse@lacave.net
NNTP-Posting-Date Sun, 24 Apr 2011 13:45:02 +0000 (UTC)
In-Reply-To <f49ba0d3c9809988b28fc4042f50998a@ruby-forum.com>
X-Received-From This message has been automatically forwarded from the ruby-talk mailing list by a gateway at comp.lang.ruby. If it is SPAM, it did not originate at comp.lang.ruby. Please report the original sender, and not us. Thanks! For more details about this gateway, please visit: http://blog.grayproductions.net/categories/the_gateway
X-Mail-Count 382121
X-Ml-Name ruby-talk
X-Rubymirror Yes
X-Ruby-Talk <f62f85247ec2e1df9d06ddccb69646a9@ruby-forum.com>
Xref x330-a1.tempe.blueboxinc.net comp.lang.ruby:3434

Show key headers only | View raw


Here's a tricky one:)

a = ["Member","Friends","Hello","Components","Family","Lastname"]
b = a.partition {|elem| true unless elem=="Components"..false }
p b
#=> [["Member","Friends","Hello"], ["Components","Family",
"Lastname"]]

-- 
Posted via http://www.ruby-forum.com/.

Back to comp.lang.ruby | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Can I split the array from text? Sira PS <ploy.sukachai@gmail.com> - 2011-04-24 03:02 -0500
  Re: Can I split the array from text? Joey Zhou <yimutang@gmail.com> - 2011-04-24 08:21 -0500
  Re: Can I split the array from text? Joey Zhou <yimutang@gmail.com> - 2011-04-24 08:35 -0500
    Re: Can I split the array from text? Roger Braun <roger@rogerbraun.net> - 2011-04-24 09:06 -0500
  Re: Can I split the array from text? Brian Candler <b.candler@pobox.com> - 2011-04-24 11:01 -0500

csiph-web