From: Michael Hayes Date: 2002-01-19T06:59:12+09:00 Subject: Chopping and chomping to no avail It seems chop and chomp just won't do what I want. My input has lines ending with \n or \r\n, possibly both in the same file, and there is also the possibility that the last line will not have either. chop works for lines ending with \n or \r\n, but incorrectly removes the last character from the last line if it's unterminated. chomp won't remove the last char from an unterminated line, but it only works on one type of record separator, so it won't handle \n and \r\n at the same time. I can say: str.chomp.chomp("\r") or make up some regexp horror, but I'd really like to know if there is some method that I've overlooked that can flexibly, reliably and safely remove a line terminator from any string. --Mike