From: Harry Kakueki Date: 2008-05-10T23:33:56+09:00 Subject: Re: "capitalize" also letters after "-" ? On Sat, May 10, 2008 at 10:52 PM, Iņaki Baz Castillo wrote: > Hi, I receive strings like: > > content-language > accept-resource-priority > > and I want to "capitalize" them in this way: > > Content-Language > Accept-Resource-Priority > > But String#capitalize method just capitalized first letter: > > Content-language > Accept-resource-priority > > > Is there any "fast" method for what I want? > Yes, I could implement it extending String class or my own class < String, but > performance is very important and I'd prefer using a method written in C > (as "String#capitalized"). Does is exist? > > > Thanks a lot. > > > -- > Iņaki Baz Castillo > > Is this too slow? str = "accept-resource-priority" p str.split(/-/).map {|x| x.capitalize}.join("-") Harry -- A Look into Japanese Ruby List in English http://www.kakueki.com/ruby/list.html