[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: regex question
- From: Diego Nehab <diego@...>
- Date: Thu, 8 Mar 2001 13:38:05 -0300 (EST)
> It would have been nice if strfind was defined as returning (start, end+1)
> instead of (start, end). I'm always having to add the +1 in my code anyway.
> Using (x, x-1) to mean zero-length is questionable in my opinion.
I prefer it the way it is. First, it is compatible with strsub. I believe
that, if it changed, the use of negative indexes (very usefull) would
become less natural.
Besides, once one overcomes his C 0-based indexing tendency, it is
pretty natural to use loops like:
for (i=s; i<=e; i++)
for (i=s; i<e+0; i++)
>From that you can also see why the empty string start and end points make