From: Morton Goldberg Date: 2007-07-28T21:23:05+09:00 Subject: Re: How to delete array element and add to previous element On Jul 27, 2007, at 11:39 PM, Al Cholic wrote: > Whats the difference between chomp and strip. I've only been using > strip. Oh, yes, there's always ri. I tend to forget about it because I rely on my pickaxe PDF. ~ mg: ri String#chomp ----------------------------------------------------------- String#chomp str.chomp(separator=$/) => new_str ------------------------------------------------------------------------ Returns a new +String+ with the given record separator removed from the end of _str_ (if present). If +$/+ has not been changed from the default Ruby record separator, then +chomp+ also removes carriage return characters (that is it will remove +\n+, +\r+, and +\r\n+). "hello".chomp #=> "hello" "hello\n".chomp #=> "hello" "hello\r\n".chomp #=> "hello" "hello\n\r".chomp #=> "hello\n" "hello\r".chomp #=> "hello" "hello \n there".chomp #=> "hello \n there" "hello".chomp("llo") #=> "he" ~ mg: ri String#strip ----------------------------------------------------------- String#strip str.strip => new_str ------------------------------------------------------------------------ Returns a copy of _str_ with leading and trailing whitespace removed. " hello ".strip #=> "hello" "\tgoodbye\r\n".strip #=> "goodbye" Regards, Morton