From: Michael Hayes Date: 2002-01-19T09:19:22+09:00 Subject: Re: Chopping and chomping to no avail "TheSchof" wrote in message news:20020118175006.10576.00001889@mb-mg.news.cs.com... > Provided you're iterating over each line you could use: > "newlines \r\n".gsub /(\r|\n)/, '' Close, but if the line contains an embedded \r it will get deleted. (I didn't mention that requirement in my post, so you are forgiven :-) The semantics I want are: - If the string does not end with \n then leave it alone. - If the string ends with \n then remove it. - if the character preceding the \n is \r then remove that too. I'm sure it's possible to do it with sub or gsub, I could probably write it myself after a few tries. I'm just kind of surprised that there is no built-in method to handle this, as snipping off line terminators is a pretty common thing to do. How about a new method called "snip"? --Mike