Make a Single Word in a String All CAPS (when returned from database) - rails
<p>Is there a way to make a single word in a string all CAPS.  The field is being returned from the database by a form.  For example, I want "Jane is the BEST programmer" for the string "jane is the best programmer".  </p>

<p>EDIT: In the view: <code>&lt;%= @sentence.capitalize %&gt;</code> <code>"hello".gsub!('best','BEST')</code> - first response below - doesn't work with that.  While this question got tagged as 'regex' by Stackoverflow, it's a rails application.</p>

<p>(And, yes, if I save "Jane is the BEST programmer" to the database and return it without <code>titleize</code> or <code>capitalize</code>, I do get "Jane is the BEST programmer".  However, this is just an example.  In the actual use case, all data / strings are converted to lower case before save. We want to capitalize some keywords for display purposes.)</p>

<p><code>titleize</code> gives me <code>Jane Is The Best Programmer</code></p>

<p><code>capitalize</code> gives me <code>Jane is the best programmer</code></p>

<p>A work-around to get <code>Jane is the BEST programmer</code> is?</p>

<p>Perhaps, parse the string and re-assemble it in the view?  Although I'd rather do it in the model layer.  Something like <code>%w{ keyword }.upcase</code>  The alternative, I suspect is using a complex regular expression - which I'd rather avoid.</p>

<p>Thanks in advance!</p>