From: Josh Cheek Date: 2010-10-17T08:06:59+09:00 Subject: Re: What's the opposite of << --001485f7c356cb9af50492c3fe0f Content-Type: text/plain; charset=ISO-8859-1 On Sat, Oct 16, 2010 at 6:00 PM, Paul Roche wrote: > But on a simple level...... > > > say in irb mode I did the following... > > > name = "John" > > name << " Smith" > > => John Smith > > > > Would it be possible to take "John" or "Smith" from name? > > -- > Posted via http://www.ruby-forum.com/. > > Yes, we can know this now that you say we are dealing with Strings. It would not work, for example, with Arrays name = "John" lastname = "Smith" name << lastname # => "JohnSmith" name.chomp! lastname name # => "John" Note that chomp! will return nil in some situations, so don't rely on assigning from it (if you want to do that, use the non-bang version) --001485f7c356cb9af50492c3fe0f--