From: Raveendran Jazzez Date: 2008-07-23T13:20:32+09:00 Subject: Re: how to capitalize a number of characters in a word Raveendran Jazzez wrote: > Cheyne Li wrote: >> Hi, there >> >> For example, how can i get "HelLoha" from "helloha" >> >> Looking forward to hearing from you. Thanks in advance > > Hi Li, > > irb(main):016:0> a="HelLoha" > => "HelLoha" > irb(main):017:0> a.downcase > => "helloha" > irb(main):018:0> > So simply reversible irb(main):016:0> a="HelLoha" => "HelLoha" irb(main):017:0> a.downcase => "helloha" irb(main):018:0> a="helloha" => "helloha" irb(main):019:0> a=a.capitalize! => "Helloha" irb(main):020:0> a=a[0,3]+a[3,1].capitalize!+a[4,3] => "HelLoha" irb(main):021:0> > Regards, > P.Raveendran > http://raveendran.wordpress.com -- Posted via http://www.ruby-forum.com/.