From: "Iñaki Baz Castillo" Date: 2008-05-11T00:48:36+09:00 Subject: Re: "capitalize" also letters after "-" ? El Sábado, 10 de Mayo de 2008, David A. Black escribió: > I have to express healthy skepticism as to whether performance is *so* > critical that you can't just do: > > str.gsub!(/((^|-).)/) { $1.upcase } Thanks, but it seems slower than using "split"/"join": Benchmark.realtime { "accept-asdasd-qweqwe".split('-').map {|w| w.capitalize}.join('-') } => 3.09944152832031e-05 Benchmark.realtime { "accept-asdasd-qweqwe".gsub!(/((^|-).)/) { $1.upcase } } => 3.60012054443359e-05 > and if it is, then I'll express healthy skepticism as to whether or > not Ruby is the right language for the job :-) Good response :) > I don't know of any C library that does the above, so if you need it, > you should probably go ahead and write it. You can base it off > rb_capitalize(_bang). ok, I'll keep this as an alternative ;) Thanks a lot. -- Iñaki Baz Castillo