[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: string-match bug?

From: Matthew Dempsky
Subject: Re: string-match bug?
Date: Wed, 9 Dec 2009 10:07:56 -0800

On Wed, Dec 9, 2009 at 9:33 AM, Andreas Röhler
<address@hidden> wrote:
> But simply by convention, isn't it?

No.  It's because it's consistent and makes sense.  That's why every
sane programming language does it this way:

C: s = "foo", strstr(s, "") evaluates to s
C++: string("foo").find("") evaluates to 0
Python: 'foo'.find('') evaluates to 0
Ruby: 'foo'.index('') evaluates to 0
Perl: index("foo", "") evaluates to 0

reply via email to

[Prev in Thread] Current Thread [Next in Thread]