[Top][All Lists]

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

Re: string-match bug?

From: Andreas Röhler
Subject: Re: string-match bug?
Date: Wed, 09 Dec 2009 19:59:52 +0100
User-agent: Thunderbird (X11/20081227)

Matthew Dempsky wrote:
> 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

CMIIW but does this example above not mean, it returns
the string? So far quite different from the rest?

Thanks all BTW, very instructive for me.


> 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]