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?

From Joey Zhou <yimutang@gmail.com>
Newsgroups comp.lang.ruby
Subject Re: Can I split the array from text?
Date 2011-04-24 08:35 -0500
Organization Service de news de lacave.net
Message-ID <f62f85247ec2e1df9d06ddccb69646a9@ruby-forum.com> (permalink)
References <f49ba0d3c9809988b28fc4042f50998a@ruby-forum.com>

Show all headers | 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