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


Groups > comp.lang.ruby > #2986

Re: chomp behaviour

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!feeder.news-service.com!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!talisker.lacave.net!lacave.net!not-for-mail
From Roy Zuo <roylzuo@gmail.com>
Newsgroups comp.lang.ruby
Subject Re: chomp behaviour
Date Fri, 15 Apr 2011 21:19:38 -0500
Organization Service de news de lacave.net
Lines 36
Message-ID <20110416021847.GA17374@bender> (permalink)
References <fd6f7d3388641b7b1873dbce2346c695@ruby-forum.com>
NNTP-Posting-Host bristol.highgroove.com
Content-Type text/plain; charset=utf-8
X-Trace talisker.lacave.net 1302920585 85144 65.111.164.187 (16 Apr 2011 02:23:05 GMT)
X-Complaints-To abuse@lacave.net
NNTP-Posting-Date Sat, 16 Apr 2011 02:23:05 +0000 (UTC)
In-Reply-To <fd6f7d3388641b7b1873dbce2346c695@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 381679
X-Ml-Name ruby-talk
X-Rubymirror Yes
X-Ruby-Talk <20110416021847.GA17374@bender>
Xref x330-a1.tempe.blueboxinc.net comp.lang.ruby:2986

Show key headers only | View raw


``echo "abc"`` outputs "abc\n", try this instead

    echo -n abc | ruby -e "puts gets.chomp 'c'"

Roy

On Sat, Apr 16, 2011 at 11:08:10AM +0900, Steel Steel wrote:
> Using 1.9.1
> I noticed something with chomp
> 
> $ echo "abc" | ruby -e 'puts gets.chomp("c")'
> abc
> 
> $ irb
> irb(main):001:0> "abc".chomp("c")
> => "ab"
> 
> It doesn't work on the command line, or am i doing it wrong.?
> comments?
> 
> -- 
> Posted via http://www.ruby-forum.com/.
> 

-- 
 ___________________________________________________________________ 
/ She's the kind of girl who climbed the ladder of success wrong by \
| wrong.                                                            |
|                                                                   |
\ -- Mae West                                                       /
 ------------------------------------------------------------------- 
       \   ,__,
        \  (oo)____
           (__)    )\
              ||--|| *

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


Thread

chomp behaviour Steel Steel <angel_steel@ymail.com> - 2011-04-15 21:08 -0500
  Re: chomp behaviour James <oscartheduck@gmail.com> - 2011-04-15 21:15 -0500
  Re: chomp behaviour Roy Zuo <roylzuo@gmail.com> - 2011-04-15 21:19 -0500
  Re: chomp behaviour Peter Zotov <whitequark@whitequark.org> - 2011-04-15 21:21 -0500
  Re: chomp behaviour Mike Stok <mike@stok.ca> - 2011-04-15 21:23 -0500

csiph-web