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


Groups > comp.lang.ruby > #5109

Re: Need help bringing select array lines together

From 7stud -- <bbxx789_05ss@yahoo.com>
Newsgroups comp.lang.ruby
Subject Re: Need help bringing select array lines together
Date Thu, 26 May 2011 17:14:46 -0500
Organization Service de news de lacave.net
Lines 31
Message-ID <15f0dba725735b0085f56c96bb926c5a@ruby-forum.com> (permalink)
References <f293c173-40a7-4d9d-b62b-9c00f079ac55@bl1g2000vbb.googlegroups.com> <20110526184256.54f1bcf6@killersmurf.com> <325f5d61-b988-47e4-8765-6aefdeebe6c9@p23g2000vbl.googlegroups.com>
NNTP-Posting-Host bristol.highgroove.com
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 7bit
X-Trace talisker.lacave.net 1306449098 36655 65.111.164.187 (26 May 2011 22:31:38 GMT)
X-Complaints-To abuse@lacave.net
NNTP-Posting-Date Thu, 26 May 2011 22:31:38 +0000 (UTC)
In-Reply-To <325f5d61-b988-47e4-8765-6aefdeebe6c9@p23g2000vbl.googlegroups.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 383825
X-Ml-Name ruby-talk
X-Rubymirror Yes
X-Ruby-Talk <15f0dba725735b0085f56c96bb926c5a@ruby-forum.com>
Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.dougwise.org!feed.ac-versailles.fr!talisker.lacave.net!lacave.net!not-for-mail
Xref x330-a1.tempe.blueboxinc.net comp.lang.ruby:5109

Show key headers only | View raw


Paul wrote in post #1001335:
> I'm not sure about the 'join' solution for 2 reasons:

Okay.  How about:

original_lines = [
  %q{"Only one line."},
  %q{"line 1 },
  %q{ line 2."},
]

combined_lines = []
temp = ''

original_lines.each do |line|
  temp << line

  if temp[-1] == %q{"}
    combined_lines << temp
    temp = ''
  end
end

p combined_lines

--output:--
["\"Only one line.\"", "\"line 1  line 2.\""]

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

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


Thread

Need help bringing select array lines together Paul <tester.paul@gmail.com> - 2011-05-26 09:26 -0700
  Re: Need help bringing select array lines together Johnny Morrice <spoon@killersmurf.com> - 2011-05-26 12:43 -0500
    Re: Need help bringing select array lines together Johnny Morrice <spoon@killersmurf.com> - 2011-05-26 12:54 -0500
    Re: Need help bringing select array lines together Paul <tester.paul@gmail.com> - 2011-05-26 14:24 -0700
      Re: Need help bringing select array lines together Johnny Morrice <spoon@killersmurf.com> - 2011-05-26 16:46 -0500
      Re: Need help bringing select array lines together 7stud -- <bbxx789_05ss@yahoo.com> - 2011-05-26 17:14 -0500
        Re: Need help bringing select array lines together Paul <tester.paul@gmail.com> - 2011-05-26 21:37 -0700
      Re: Need help bringing select array lines together 7stud -- <bbxx789_05ss@yahoo.com> - 2011-05-26 17:31 -0500
    Re: Need help bringing select array lines together 7stud -- <bbxx789_05ss@yahoo.com> - 2011-05-26 17:33 -0500
      Re: Need help bringing select array lines together Gary Wright <gwtmp01@mac.com> - 2011-05-26 17:45 -0500
        Re: Need help bringing select array lines together Johnny Morrice <spoon@killersmurf.com> - 2011-05-26 18:05 -0500
  Re: Need help bringing select array lines together Bala TS <bdeveloper01@yahoo.com> - 2011-05-26 23:53 -0500

csiph-web