From: Robin Stocker Date: 2006-07-09T04:23:38+09:00 Subject: Re: String#starts_with? Marcin Miel��y��ski wrote: > String#index should be the fastest I'm afraid it isn't suitable for this case. String#index searches the whole string when the string doesn't start with the start, which is very bad. Use String#[] or a regular expression: text = "this is a test" search = "this" text[0, search.length] == search #=> true text =~ /^this/ #=> 0 (true) text =~ /^test/ #=> nil (false) Cheers, Robin Stocker