Phrogz,
What does the "i" do in
gsub(/\b[a-z]/i){ |x| x.upcase }
do?
I took it out and the pattern seemed to work.
Ralph
Monday, November 9, 2009, 10:10:07 PM, you wrote:
P> On Nov 9, 1:43m, Sijo k g <cijokgeo... / yahoo.co.in> wrote:
>> Hi
>> I would like to get output as Re-Open" or the input "re-open"
>> And I tried
>> "re-open".camelize => Re-open"
>>
>> ould you please tell how can I do this?
irb(main):001:0>> s = "re-open"
=>> "re-open"
irb(main):002:0>> class String; def simple_titleize
irb(main):003:2>> gsub(/\b[a-z]/i){ |x| x.upcase }
irb(main):004:2>> end; end
=>> nil
irb(main):005:0>> s.simple_titleize
=>> "Re-Open"
--
Best regards,
Ralph mailto:ralphs / dos32.com