From: Gavin Sinclair Date: 2007-08-06T16:24:57+09:00 Subject: Re: Determining the common prefix for several strings On Aug 3, 5:58 pm, Pe�a, Botp wrote: > > min = list.sort!{|a,b| a.size <=> b.size}.first > break if list.all?{|a| a =~ /^#{min}/} while min.chop! > I just realised that the solution I just posted elsewhere in this thread is very very similar to this one. Be careful that using bang methods in chains is sometimes problematic, as they can return nil if nothing changes (sort! doesn't have this problem). For interested readers, find the problem with this code: title = "the moon in june" title.downcase!.capitalize! Cheers, Gavin