Subject Re: The POSITION
Author m_theologos
--- In Firebird-Architect@yahoogroups.com,
"legrand_legrand_63" <grand.brun.63@...> wrote:
>
> --- In Firebird-Architect@yahoogroups.com, "m_theologos"
> <theologos@> wrote:
> >
> > --- In Firebird-Architect@yahoogroups.com,
> > "legrand_legrand_63" <grand.brun.63@> wrote:
> > >
> > > For information STRPOS (rfunc UDF Library) could be a short
term
> > solution.
> > >
> > > Regarding SQL standard,
> > > what should be the POSITION behavior when finding more than one
> > result:
> > > - returns the 1rst occurence position ?
> > > - returns 0 (thats the way STRPOS do) ?
> > >
> >
> > - 1st occurence.
> >
> > > Oracle's way is:
> > > INSTR ( string , substring
> > > , position
> > > , occurrence
> > > )
> > > that permits to start the search at a fix position <> 1 and
permits
> > to
> > > catch the Nth occurence of the substring.
> > >
> >
> > Also I think that its good to have these optional params.
> > Also, is very usefull especially for parsing path strings ie.
> > filepaths like \\Server-A\Share-1\MyFile.txt
> > web addr like http://tech.groups.yahoo.com/group/Firebird-
Architect
> > tel numbers and zip codes like: 0050-0234-567890
> >
> > to have a (non-standard) RPOSITION which scans the string from
right
> > to left...
> >
> > Any comments?
> >
> I forgot to tell you:
> in Oracle's INSTR "occurence" can be a negativ integer, permitting
> search from right to left witin the same buit-in function ;o)
>

Also, I thought the same. But I think that isn't so clear what's the
meaning of -1 (ie. the 1st occurence from the right). I think that
isn't so appropiate in spirit of SQL. But if is easier to implement,
so far so good...

HTH,

m. th.