Do you mean
irb(main):003:0> words = "foo bar baz"
=> "foo bar baz"
irb(main):004:0> words.sub(/\w+/) {|m| "<b>#{m.upcase}</b>"}
=> "<b>FOO</b> bar baz"
irb(main):005:0> words.sub(/\w+/) {|m| "<b>#{m.capitalize}</b>"}
=> "<b>Foo</b> bar baz"
irb(main):006:0>
Kind regards
robert
···
On 04.06.2009 21:41, Rails List wrote:
I have a string that I would like to capitalize and add bold html tag to
the first word only. How do i do it?. Do I have to split first and
then "upcase!" it then join again. Not sure how to do it. any help is
much appreciated. thanks
--
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/