Highlighting words in text

If I have a string: @tmp = “This is a test string 1 2 3 testing…”
and I want to higlight a string “test” when I show it on a page, so how
I can do it?

Result shold be like this: “This is a test string 1 2 3
testing”

<%= highlight “your text”, [“test”], “\1” %>

See the ActionView::Helpers::TextHelper#highlight method. :slight_smile:

–Jeremy

On Jan 5, 2008 12:23 PM, Gi Ga [email protected] wrote:


http://www.jeremymcanally.com/

My books:
Ruby in Practice

My free Ruby e-book

My blogs:

http://www.rubyinpractice.com/

Jeremy McAnally wrote:

See the ActionView::Helpers::TextHelper#highlight method. :slight_smile:

Sorry :slight_smile: Thanks!