rindex - Locates character in string (last occurence).
rindex(string, char) rindex (str:"…", chr:"…")
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.
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:"é"); ",";
}}.
{{ include("includes/strings.sn") }}
Written by Pierre Laplante and Caroline Laplante, <laplante@sednove.com>
1.0 2014-09-09 21:24:14 laplante@sednove.com
Edit© 2025 extenso Inc. All rights reserved.