Hi,

I don't know if the SQLite SQL function are coming from a sql specs standard.

I guess however that a better usable string function for manage paths
is one function that retrieve the last occurrence of a string.
Because very often the need is to extract the last part of a filepath.

my 2ct,

A.



2014-10-26 13:27 GMT+01:00 Baruch Burstein <bmburst...@gmail.com>:
> Hi!
>
> I have a column which represents a file path:
>
> ab/cd/gf
> ab/qw/ert
> ab/fgrd/ert
> ab/foo/bar/fgr
> ab/bar/foo/foobar/etc
> ab/etc/d
> etc...
>
> I happen to know in my case that the first part of the path is a certain
> fixed string ('ab' in the above example). I need to get the path with the
> first 2 parts stripped off. Currently I am doing:
>
>         substr(path, 4+instr(substr(path,4),'/'))
>
> But that seems long and probably inefficient.
> What is the best/simplest way to find the second occurrence of the '/' in a
> string?
>
> Also, a suggestion for an SQLite improvement: The builtin function instr()
> should have another form that takes 3 arguments, with the 3rd being either
> an offset from where to start the search, or which occurrence to search for
> (1st, 2nd, etc.)
>
> --
> ˙uʍop-ǝpısdn sı ɹoʇıuoɯ ɹnoʎ 'sıɥʇ pɐǝɹ uɐɔ noʎ ɟı
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users



-- 
-----------------
Andrea Peri
. . . . . . . . .
qwerty àèìòù
-----------------
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to