From: nobu.nokada@... Date: 2003-11-27T14:21:06+09:00 Subject: Re: String startswith/endswith in Ruby? Hi, At Wed, 19 Nov 2003 08:52:18 +0900, Dave Benjamin wrote: > s = 'Hello, world!' > s.startswith('Hello') >> true > s.endswith('!') >> true > s.endswith('asdf') >> false I often use class String def startswith(sub) rindex(sub, 0) end def endswith(sub) index(sub, -sub.length) end end -- Nobu Nakada