LASTPOS

 ──LASTPOS(needle,haystack──┬─────────┬─)─────
                              └─,start──┘

LASTPOS returns the position of the last occurrence of one string, needle, in another, haystack. If the string needle is not found, 0 is returned. By default the search starts at the last character of haystack (that is, start=LENGTH(string)) and scans backwards. You can override this by specifying start, as the point at which the backward scan starts. start must be a positive whole number, and defaults to LENGTH(string) if larger than that value.

Here are some examples:

LASTPOS(' ','abc def ghi')      ->    8
LASTPOS(' ','abcdefghi')        ->    0
LASTPOS(' ','abc def ghi',7)    ->    4


[Back: INSERT]
[Next: LEFT]