function

rindex . string . sncode

VERSIONlatest Locate character in string (last occurence).

RINDEX

NAME

rindex - Locates character in string (last occurence).

SYNOPSIS

rindex(string, char) rindex (str:"…", chr:"…")

DESCRIPTION

The rindex() function returns a substring to the last occurrence of the character c in the string s.

The index() function returns a substring to the first occurrence of the character c in the string s.

EXAMPLES

Note: In the followings examples, the _ between the { should be removed to make it work.

test res={_{
        rindex("pierre","p"); ",";
        rindex("pierre","i"); ",";
        rindex("pierre","e"); ",";
        rindex("pierre","r"); ",";
        x = rindex("pierre","x");
        if (x == null) then
                "x is null";
        endif
        rindex(str:"piérre",chr:"é"); ",";
}}.

Got: 'res=pierre,ierre,e,re,x is nullérre,.'

res={_{
        index("pierre","p"); ",";
        index("pierre","i"); ",";
        index("pierre","e"); ",";
        index("pierre","r"); ",";
        x = index("pierre","x");
        if (x == null) then
                "x is null";
        endif
        index(str:"piérre",chr:"é"); ",";
}}.

AUTHOR

Written by Pierre Laplante and Caroline Laplante, <laplante@sednove.com>