Could not find that function in basex. Other xquery implementations seem to script this in xquery itself via declare function...
This might help: http://www.xqueryfunctions.com/xq/functx_index-of-string-last.html
You may include all FunctX functions by installing the repo module:
http://docs.basex.org/wiki/Packaging
Hth, C.