LASTPOS(needle,haystack[,position]) This function finds the last occurrence, if any, of the needle within haystack. The answer is the position of the last occurrence if there is one (numbering from 1 to the length of haystack), or zero if needle does not occur in haystack. If the optional position is supplied, the search starts from this position instead of the end of haystack. If the needle is the empty string, zero is returned.