From: Frederick Cheung Date: 2007-12-29T23:20:24+09:00 Subject: Re: String highlighting problem (newbie) On 29 Dec 2007, at 13:47, Mark Toth wrote: > I have two questions: > > 1. I have a string > @string = "This is a long string". > > How can I do to make two words "bold" or "italic" in this string, for > example "is" and "long" shoudl be ? > I would probably use gsub. But at the end of the day it depends on how the words to be bolded are determined. > > 2. I am searching in the mysql database with this code: > > @results = Product.find(:all, :conditions => [ "name LIKE ?", > "%"+@searchstring+"%"]) > > What if I want to search for many words in different order? I mean > if I > should searched for example: "string is a long this" in the string > above? You need a full text search engine, for example the one in mysql, ferret, sphinx etc... Fred > > > Thanks, > > Mark > -- > Posted via http://www.ruby-forum.com/. >