From: Peter Vandenabeele Date: 2011-10-01T22:03:22+09:00 Subject: Re: IO.readlines will not accept variable with file name Why? --0016e6505d8e9d20d104ae3c5d86 Content-Type: text/plain; charset=UTF-8 On Fri, Sep 30, 2011 at 4:01 PM, Brian Candler wrote: > Peter Vandenabeele wrote in post #1024278: > > >> Peter is there any difference between chomp and > >> This: > >> string = string.gsub(/\n/," ") > >> chomp looks easier to remember. > > > > Well yes, a lot of difference ... > > > > gsub(/\n/, "") will produce a new string, where occurences of a newline > > character ("\n") are replaced with a space. > > > > chomp will remove the last newline/carriage return combination > > (0 or 1 CR and 0 or 1 LF if I am right). > > chomp does also produce a new string: > Indeed, thanks for pointing that out. Peter --0016e6505d8e9d20d104ae3c5d86--