From: Gavin Sinclair Date: 2003-09-13T09:54:56+09:00 Subject: Re: String#start_with? / #end_with? On Saturday, September 13, 2003, 7:07:24 AM, Philip wrote: > Is there a built-in method in Ruby for checking whether a string starts > with or ends with a pattern? e.g.: > "Hello, world".start_with?("Hello") => true > "Hello, world".start_with?("world") => false > http://www.rubygarden.org/article.php?sid=312 suggests that such a > method was suggested for inclusion into Ruby, but I don't see it in > version 1.8.0. You might get somewhere with this: str = "Hello, world" str["Hello"] == 0 # -> true Dunno about :end_with? though. Gavin