From: Kaldrenon Date: 2007-08-18T04:44:59+09:00 Subject: Re: removing something from the end of each item in an array On Aug 17, 2:30 pm, "Simon Schuster" wrote: > in this case a "\n"... > > ["blah\n", "la\n", "hooray\n"] > > array.collect { |x| x - "\n" } doesn't work, and I can't manage to > find any methods which might do the trick.. pretty basic, but I'm > still a beginner! thanks. As others have already said, probably the best way to remove \n from a string's end is chomp or chomp! (the version with ! does an edit in place, the version without returns the modification without changing the original string) However, this method won't work if, as your subject line implies, you end up wanting to remove something else from a string. I would recommend looking at http://www.whytheluckystiff.net/ruby/pickaxe/html/ref_c_string.html It will show you everything you need to know about lovely methods like delete, gsub, tr, and more. HTH -Andrew